@remix_labs/hub-client 1.1890.0-dev → 1.1898.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.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -440,23 +440,23 @@ class Worker {
440
440
  this.noreconfigure = true;
441
441
  return;
442
442
  };
443
+ let bundle;
443
444
  if (globalThis.ThisIsNode) {
444
- this.worker = new globalThis.Worker(new URL("./hub-worker.mjs", import.meta.url));
445
- } else {
445
+ bundle = new URL("../../hub-worker/src/node.js", import.meta.url);
446
+ } else if (globalThis.GROOVEBOX_URL_PREFIX) {
446
447
  // FIXME: Stopgap solution until we figure out a way to bundle groovebox correctly
447
- let baseURL = globalThis.GROOVEBOX_URL_PREFIX || "/g";
448
-
449
- let bundle = new URL(`${baseURL}/hub-worker.js`, window.location.href);
450
- this.worker = new globalThis.Worker(bundle);
448
+ bundle = new URL(`${globalThis.GROOVEBOX_URL_PREFIX}/hub-worker.js`, window.location.href);
449
+ } else {
450
+ bundle = new URL("/g/hub-worker.js", window.location.href);
451
451
  }
452
+ this.worker = new globalThis.Worker(bundle);
452
453
  globalThis.RmxMessagingHub = this;
453
454
  let thisworker = this;
454
455
  this.expect = new Array(0);
455
- this.worker.on("message", (ev => {
456
+ this.worker.onmessage = (ev => {
456
457
  let f = thisworker.expect.shift();
457
- f(ev);
458
- }));
459
-
458
+ f(ev)
459
+ });
460
460
  this.noreconfigure = false;
461
461
  terminate(() => thisworker.worker.terminate());
462
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/hub-client",
3
- "version": "1.1890.0-dev",
3
+ "version": "1.1898.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.1890.0-dev"
14
+ "@remix_labs/web-worker-onlymain": "1.1898.0-dev"
15
15
  },
16
16
  "repository": "https://github.com/remixlabs/groovebox.git"
17
17
  }