@remix_labs/hub-client 2.12944.0-dev → 2.12946.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/common.js +27 -4
  2. package/package.json +1 -1
package/common.js CHANGED
@@ -388,6 +388,26 @@ class Channel {
388
388
  })
389
389
  }
390
390
 
391
+ disconnect(clientName) {
392
+ return new Promise((resolve, reject) => {
393
+ let reqId = this.reqId + 1;
394
+ this.reqId = reqId;
395
+ this.expect.set(reqId, (resp => {
396
+ this.expect.delete(reqId);
397
+ if (resp.data.error == null) {
398
+ resolve(resp.data)
399
+ } else
400
+ reject(resp.data);
401
+ }));
402
+ let disconnMsg =
403
+ { _rmx_type: "msg_hub_disconnect",
404
+ reqId: reqId,
405
+ clientName: clientName
406
+ };
407
+ this.port.postMessage(disconnMsg)
408
+ })
409
+ }
410
+
391
411
  setLocalPubTopic(topic) {
392
412
  return new Promise((resolve, reject) => {
393
413
  let reqId = this.reqId + 1;
@@ -426,7 +446,7 @@ class Channel {
426
446
  })
427
447
  }
428
448
 
429
- newChannel() {
449
+ newChannel(clientName) {
430
450
  return new Promise((resolve, reject) => {
431
451
  let reqId = this.reqId + 1;
432
452
  this.reqId = reqId;
@@ -441,7 +461,8 @@ class Channel {
441
461
  }));
442
462
  let msg =
443
463
  { _rmx_type: "msg_hub_newChannel",
444
- reqId: reqId
464
+ reqId: reqId,
465
+ clientName: clientName
445
466
  };
446
467
  this.port.postMessage(msg);
447
468
  })
@@ -531,7 +552,7 @@ class Worker {
531
552
  })
532
553
  }
533
554
 
534
- newChannel() {
555
+ newChannel(clientName) {
535
556
  let thisworker = this;
536
557
  return new Promise((resolve, reject) => {
537
558
  thisworker.expect.push(resp => {
@@ -543,7 +564,9 @@ class Worker {
543
564
  reject(resp.data)
544
565
  });
545
566
  let msg =
546
- { "_rmx_type": "msg_hub_newChannel" };
567
+ { "_rmx_type": "msg_hub_newChannel",
568
+ clientName: clientName
569
+ };
547
570
  thisworker.worker.postMessage(msg);
548
571
  })
549
572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/hub-client",
3
- "version": "2.12944.0-dev",
3
+ "version": "2.12946.0-dev",
4
4
  "description": "talk to the Hub web worker",
5
5
  "main": "node.js",
6
6
  "browser": "index.js",