@remix_labs/hub-client 2.12820.0-dev → 2.12822.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/common.js +0 -17
- package/package.json +1 -1
package/common.js
CHANGED
|
@@ -309,14 +309,6 @@ class Channel {
|
|
|
309
309
|
})
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// Releases the channel: asks the hub to drop this channel's subscriptions and its end of
|
|
313
|
-
// the MessagePort, then closes ours. The channel must not be used afterwards.
|
|
314
|
-
close() {
|
|
315
|
-
try { this.port.postMessage({ _rmx_type: "msg_hub_closeChannel" }); } catch (_) {}
|
|
316
|
-
try { this.port.onmessage = null; this.port.close(); } catch (_) {}
|
|
317
|
-
this.expect.clear();
|
|
318
|
-
}
|
|
319
|
-
|
|
320
312
|
publish(topic, msg, retained) {
|
|
321
313
|
return new Promise((resolve, reject) => {
|
|
322
314
|
let reqId = this.reqId + 1;
|
|
@@ -546,8 +538,6 @@ class Worker {
|
|
|
546
538
|
if (resp.data.error == null) {
|
|
547
539
|
let port = resp.ports !== undefined ? resp.ports[0] : resp.data.port;
|
|
548
540
|
let hubch = new Channel(port);
|
|
549
|
-
// the hub worker wraps its replies as {data: msg}
|
|
550
|
-
hubch.chanId = (resp.data.data !== undefined ? resp.data.data : resp.data).chanId;
|
|
551
541
|
resolve(hubch);
|
|
552
542
|
} else
|
|
553
543
|
reject(resp.data)
|
|
@@ -558,13 +548,6 @@ class Worker {
|
|
|
558
548
|
})
|
|
559
549
|
}
|
|
560
550
|
|
|
561
|
-
// Closes the hub's end of a channel whose own end lives elsewhere (e.g. was transferred to a
|
|
562
|
-
// worker that has since been terminated). No reply.
|
|
563
|
-
closeChannelById(chanId) {
|
|
564
|
-
if (chanId === undefined) return;
|
|
565
|
-
try { this.worker.postMessage({ "_rmx_type": "msg_hub_closeChannelId", chanId: chanId }); } catch (_) {}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
551
|
newJSONMessage(rmxType, sender, payload) {
|
|
569
552
|
return new JSONMessage(rmxType, sender, payload);
|
|
570
553
|
}
|