cross-tab-worker-databus 0.21.14 → 0.21.16
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/CHANGELOG.md +39 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-3XBN7FFJ.js → chunk-GQ6NYWQL.js} +21 -6
- package/dist/{chunk-3XBN7FFJ.js.map → chunk-GQ6NYWQL.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +20 -5
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +20 -5
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +7 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/api.md +1 -1
- package/docs/architecture.md +5 -4
- package/docs/release-checklist.md +1 -1
- package/docs/roadmap.md +57 -1
- package/docs/zh/api.md +1 -1
- package/docs/zh/architecture.md +5 -4
- package/docs/zh/release-checklist.md +1 -1
- package/docs/zh/roadmap.md +49 -1
- package/package.json +1 -1
package/dist/cjs/centrifuge.cjs
CHANGED
|
@@ -2539,7 +2539,7 @@ var DedupManager = class {
|
|
|
2539
2539
|
};
|
|
2540
2540
|
|
|
2541
2541
|
// src/core/version.ts
|
|
2542
|
-
var SDK_VERSION = true ? "0.21.
|
|
2542
|
+
var SDK_VERSION = true ? "0.21.16" : "";
|
|
2543
2543
|
|
|
2544
2544
|
// src/core/data-bus.ts
|
|
2545
2545
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -3490,12 +3490,18 @@ var CrossTabDataBus = class {
|
|
|
3490
3490
|
subscribeTransport(topic) {
|
|
3491
3491
|
if (this.transportSubscribedTopics.has(topic)) return false;
|
|
3492
3492
|
this.transportSubscribedTopics.add(topic);
|
|
3493
|
-
this.runTransport(
|
|
3493
|
+
this.runTransport(
|
|
3494
|
+
() => this.transport.subscribe(topic),
|
|
3495
|
+
() => this.transportSubscribedTopics.has(topic)
|
|
3496
|
+
);
|
|
3494
3497
|
return true;
|
|
3495
3498
|
}
|
|
3496
3499
|
unsubscribeTransport(topic) {
|
|
3497
3500
|
if (!this.transportSubscribedTopics.delete(topic)) return false;
|
|
3498
|
-
this.runTransport(
|
|
3501
|
+
this.runTransport(
|
|
3502
|
+
() => this.transport.unsubscribe(topic),
|
|
3503
|
+
() => !this.transportSubscribedTopics.has(topic)
|
|
3504
|
+
);
|
|
3499
3505
|
return true;
|
|
3500
3506
|
}
|
|
3501
3507
|
/** Invoke `callback` for each item in `handlers`, isolating a throwing
|
|
@@ -3613,8 +3619,15 @@ var CrossTabDataBus = class {
|
|
|
3613
3619
|
* Run a transport operation now if the transport is ready, otherwise queue
|
|
3614
3620
|
* it behind the start promise. This ensures subscribe/unsubscribe calls made
|
|
3615
3621
|
* during startup are not lost.
|
|
3622
|
+
*
|
|
3623
|
+
* `stillWanted` expresses the deferred work as the *current* desired state
|
|
3624
|
+
* rather than a captured call, and is checked at each place that resumes on a
|
|
3625
|
+
* later task — the recovery gate and the opening flush. The immediate branch
|
|
3626
|
+
* carries no check because every path into it evaluates the desired state in
|
|
3627
|
+
* the same task: a caller that just mutated `transportSubscribedTopics`, or
|
|
3628
|
+
* the gate re-entry one line above.
|
|
3616
3629
|
*/
|
|
3617
|
-
runTransport(operation) {
|
|
3630
|
+
runTransport(operation, stillWanted) {
|
|
3618
3631
|
if (this.suspended) return;
|
|
3619
3632
|
if (this.recoveryGate && !this.stopping) {
|
|
3620
3633
|
const gate = this.recoveryGate;
|
|
@@ -3624,7 +3637,8 @@ var CrossTabDataBus = class {
|
|
|
3624
3637
|
void gate.then(() => {
|
|
3625
3638
|
this.recoveryWaiters -= 1;
|
|
3626
3639
|
if (this.stopping || this.suspended || cancellationToken !== this.recoveryCancellationToken) return;
|
|
3627
|
-
|
|
3640
|
+
if (stillWanted && !stillWanted()) return;
|
|
3641
|
+
this.runTransport(operation, stillWanted);
|
|
3628
3642
|
});
|
|
3629
3643
|
return;
|
|
3630
3644
|
}
|
|
@@ -3645,6 +3659,7 @@ var CrossTabDataBus = class {
|
|
|
3645
3659
|
void ready.then(
|
|
3646
3660
|
() => {
|
|
3647
3661
|
if (!this.started || this.stopping || this.suspended) return;
|
|
3662
|
+
if (stillWanted && !stillWanted()) return;
|
|
3648
3663
|
return operation();
|
|
3649
3664
|
},
|
|
3650
3665
|
// The opening promise reports its own lifecycle failure through
|