-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch mock-socket@9.1.3 for the project I'm working on.
Events from server to client needs to have some delay to mimic network delay.
Here is the diff that solved my problem:
diff --git a/node_modules/mock-socket/dist/mock-socket.js b/node_modules/mock-socket/dist/mock-socket.js
index 2478234..414d406 100644
--- a/node_modules/mock-socket/dist/mock-socket.js
+++ b/node_modules/mock-socket/dist/mock-socket.js
@@ -793,13 +793,16 @@ EventTarget.prototype.dispatchEvent = function dispatchEvent (event) {
return false;
}
- listeners.forEach(function (listener) {
- if (customArguments.length > 0) {
- listener.apply(this$1, customArguments);
- } else {
- listener.call(this$1, event);
- }
- });
+ delay(function()
+ {
+ listeners.forEach(function (listener) {
+ if (customArguments.length > 0) {
+ listener.apply(this$1, customArguments);
+ } else {
+ listener.call(this$1, event);
+ }
+ });
+ })
return true;
};This issue body was partially generated by patch-package.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels