@remix_labs/hub-client 1.1884.0-dev → 1.1886.0-dev
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/index.js +0 -11
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -434,9 +434,7 @@ class Channel {
|
|
|
434
434
|
// once.
|
|
435
435
|
class Worker {
|
|
436
436
|
constructor() {
|
|
437
|
-
console.log("building worker");
|
|
438
437
|
if (globalThis.RmxMessagingHub) {
|
|
439
|
-
console.log("worker: global hub exists");
|
|
440
438
|
this.worker = globalThis.RmxMessagingHub.worker;
|
|
441
439
|
this.expect = globalThis.RmxMessagingHub.expect;
|
|
442
440
|
this.noreconfigure = true;
|
|
@@ -445,7 +443,6 @@ class Worker {
|
|
|
445
443
|
if (globalThis.ThisIsNode) {
|
|
446
444
|
this.worker = globalThis.getHubWorker();
|
|
447
445
|
//this.worker = new globalThis.Worker(new URL("./hub-worker.js", import.meta.url));
|
|
448
|
-
console.log("made a worker for hub-worker");
|
|
449
446
|
} else {
|
|
450
447
|
let bundle;
|
|
451
448
|
if (globalThis.GROOVEBOX_URL_PREFIX) {
|
|
@@ -459,12 +456,9 @@ class Worker {
|
|
|
459
456
|
globalThis.RmxMessagingHub = this;
|
|
460
457
|
let thisworker = this;
|
|
461
458
|
this.expect = new Array(0);
|
|
462
|
-
// TODO: does this work on web, too?
|
|
463
459
|
this.worker.on("message", (ev => {
|
|
464
|
-
console.log("hub-client got message");
|
|
465
460
|
let f = thisworker.expect.shift();
|
|
466
461
|
f(ev);
|
|
467
|
-
console.log("hub-client handled message");
|
|
468
462
|
}));
|
|
469
463
|
|
|
470
464
|
this.noreconfigure = false;
|
|
@@ -472,16 +466,13 @@ class Worker {
|
|
|
472
466
|
}
|
|
473
467
|
|
|
474
468
|
configure(config_obj) {
|
|
475
|
-
console.log("worker.configure");
|
|
476
469
|
if (this.noreconfigure) {
|
|
477
470
|
console.warn("The global hub-client is already configured");
|
|
478
471
|
return;
|
|
479
472
|
};
|
|
480
473
|
let thisworker = this;
|
|
481
474
|
return new Promise((resolve, reject) => {
|
|
482
|
-
console.log("in promise");
|
|
483
475
|
thisworker.expect.push(resp => {
|
|
484
|
-
console.log("in expect.push callback");
|
|
485
476
|
if (resp.data.error == null)
|
|
486
477
|
resolve(resp.data);
|
|
487
478
|
else
|
|
@@ -495,9 +486,7 @@ class Worker {
|
|
|
495
486
|
"token": config_obj.token,
|
|
496
487
|
"standalone": config_obj.standalone === true
|
|
497
488
|
};
|
|
498
|
-
console.log("posting msg");
|
|
499
489
|
thisworker.worker.postMessage(config_msg);
|
|
500
|
-
console.log("posted msg");
|
|
501
490
|
})
|
|
502
491
|
}
|
|
503
492
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix_labs/hub-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1886.0-dev",
|
|
4
4
|
"description": "talk to the Hub web worker",
|
|
5
5
|
"main": "node.js",
|
|
6
6
|
"browser": "index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Remixlabs staff",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@remix_labs/web-worker-onlymain": "1.
|
|
14
|
+
"@remix_labs/web-worker-onlymain": "1.1886.0-dev"
|
|
15
15
|
},
|
|
16
16
|
"repository": "https://github.com/remixlabs/groovebox.git"
|
|
17
17
|
}
|