@remix_labs/hub-client 2.2063.0-dev → 2.2067.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.js +14 -21
- package/package.json +1 -1
package/common.js
CHANGED
|
@@ -430,15 +430,21 @@ class Channel {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
// This class starts the web worker for the hub.
|
|
434
|
-
//
|
|
435
|
-
|
|
436
|
-
// you every time the same worker
|
|
437
|
-
class ScopedWorker {
|
|
433
|
+
// This class starts the web worker for the hub. Should only be instantiated
|
|
434
|
+
// once.
|
|
435
|
+
class Worker {
|
|
438
436
|
constructor() {
|
|
437
|
+
if (globalThis.RmxMessagingHub) {
|
|
438
|
+
this.worker = globalThis.RmxMessagingHub.worker;
|
|
439
|
+
this.expect = globalThis.RmxMessagingHub.expect;
|
|
440
|
+
this.noreconfigure = true;
|
|
441
|
+
return;
|
|
442
|
+
};
|
|
443
|
+
|
|
439
444
|
// injected by either index.js or node.js
|
|
440
445
|
this.worker = globalThis.GetHubWorker();
|
|
441
446
|
|
|
447
|
+
globalThis.RmxMessagingHub = this;
|
|
442
448
|
let thisworker = this;
|
|
443
449
|
this.expect = new Array(0);
|
|
444
450
|
// sigh, browser/node have a different API for this
|
|
@@ -455,6 +461,7 @@ class ScopedWorker {
|
|
|
455
461
|
}
|
|
456
462
|
|
|
457
463
|
this.noreconfigure = false;
|
|
464
|
+
terminate(() => thisworker.worker.terminate());
|
|
458
465
|
}
|
|
459
466
|
|
|
460
467
|
configure(config_obj) {
|
|
@@ -520,19 +527,5 @@ class ScopedWorker {
|
|
|
520
527
|
}
|
|
521
528
|
}
|
|
522
529
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
if (globalThis.RmxMessagingHub) {
|
|
526
|
-
this.worker = globalThis.RmxMessagingHub.worker;
|
|
527
|
-
this.expect = globalThis.RmxMessagingHub.expect;
|
|
528
|
-
this.noreconfigure = true;
|
|
529
|
-
return;
|
|
530
|
-
};
|
|
531
|
-
super();
|
|
532
|
-
globalThis.RmxMessagingHub = this;
|
|
533
|
-
terminate(() => thisworker.worker.terminate());
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
export { Worker, ScopedWorker, Channel,
|
|
538
|
-
JSONMessage, TextMessage, BinaryMessage, LocalMessage, EOF }
|
|
530
|
+
export { Worker, Channel, JSONMessage, TextMessage, BinaryMessage, LocalMessage,
|
|
531
|
+
EOF }
|