cross-tab-worker-databus 0.20.93 → 0.20.95
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 +22 -0
- package/dist/centrifuge.d.ts +4 -4
- package/dist/centrifuge.d.ts.map +1 -1
- package/dist/centrifuge.js +13 -14
- package/dist/centrifuge.js.map +2 -2
- package/dist/centrifuge.shared.worker.js +44 -21
- package/dist/centrifuge.shared.worker.js.map +3 -3
- package/dist/centrifuge.worker.js +44 -21
- package/dist/centrifuge.worker.js.map +3 -3
- package/dist/{chunk-OXEPZGXR.js → chunk-7BPB2Y4E.js} +18 -14
- package/dist/chunk-7BPB2Y4E.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +29 -26
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/hooks.cjs +1 -4
- package/dist/cjs/hooks.cjs.map +2 -2
- package/dist/cjs/index.cjs +17 -13
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/vue.cjs +1 -5
- package/dist/cjs/vue.cjs.map +2 -2
- package/dist/core/cluster.d.ts.map +1 -1
- package/dist/core/environment.d.ts.map +1 -1
- package/dist/core/storage-batch.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +1 -4
- package/dist/hooks.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +1 -5
- package/dist/vue.js.map +2 -2
- package/docs/benchmarks.md +10 -10
- package/docs/configuration.md +3 -1
- package/docs/release-checklist.md +2 -2
- package/docs/roadmap.md +21 -6
- package/docs/zh/benchmarks.md +10 -10
- package/docs/zh/configuration.md +3 -1
- package/docs/zh/release-checklist.md +2 -2
- package/docs/zh/roadmap.md +21 -6
- package/package.json +3 -2
- package/dist/chunk-OXEPZGXR.js.map +0 -7
|
@@ -45,6 +45,7 @@ function createStorageEventChannel(options) {
|
|
|
45
45
|
if (!storage || !win) return null;
|
|
46
46
|
const key = `${STORAGE_CHANNEL_PREFIX}${name}`;
|
|
47
47
|
const listeners = /* @__PURE__ */ new Set();
|
|
48
|
+
const senderId = randomId();
|
|
48
49
|
let sequence = 0;
|
|
49
50
|
const onStorage = (event) => {
|
|
50
51
|
if (event.key !== key || event.newValue === null) return;
|
|
@@ -57,7 +58,12 @@ function createStorageEventChannel(options) {
|
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
const event_ = { data: message };
|
|
60
|
-
for (const listener of [...listeners])
|
|
61
|
+
for (const listener of [...listeners]) {
|
|
62
|
+
try {
|
|
63
|
+
listener(event_);
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
61
67
|
};
|
|
62
68
|
win.addEventListener("storage", onStorage);
|
|
63
69
|
let closed = false;
|
|
@@ -71,7 +77,7 @@ function createStorageEventChannel(options) {
|
|
|
71
77
|
postMessage(message) {
|
|
72
78
|
if (closed) return;
|
|
73
79
|
sequence += 1;
|
|
74
|
-
storage.setItem(key, JSON.stringify({ seq: sequence, message }));
|
|
80
|
+
storage.setItem(key, JSON.stringify({ senderId, seq: sequence, message }));
|
|
75
81
|
},
|
|
76
82
|
close() {
|
|
77
83
|
closed = true;
|
|
@@ -525,11 +531,11 @@ var BatchingStorageWriter = class {
|
|
|
525
531
|
if (typeof queueMicrotask === "function") queueMicrotask(flush);
|
|
526
532
|
else setTimeout(flush, 0);
|
|
527
533
|
}
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
//
|
|
534
|
+
// Arm the single backoff timer for the pass that just failed. Exactly one
|
|
535
|
+
// retry can be in flight because flush() — the only caller — cancels any
|
|
536
|
+
// armed retry on entry and stops at the first failing key, so this always
|
|
537
|
+
// runs with `retryHandle` cleared.
|
|
531
538
|
scheduleRetry() {
|
|
532
|
-
if (this.retryHandle !== null) return;
|
|
533
539
|
this.retryHandle = setTimeout(() => {
|
|
534
540
|
this.retryHandle = null;
|
|
535
541
|
this.flush();
|
|
@@ -613,9 +619,8 @@ var WorkerClusterRuntime = class {
|
|
|
613
619
|
touchRouteOwnerCache(topicKey, value) {
|
|
614
620
|
if (this.routeOwnerCache.has(topicKey)) this.routeOwnerCache.delete(topicKey);
|
|
615
621
|
this.routeOwnerCache.set(topicKey, value);
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
if (oldest === void 0) break;
|
|
622
|
+
for (const oldest of this.routeOwnerCache.keys()) {
|
|
623
|
+
if (this.routeOwnerCache.size <= this.routeOwnerCacheMax) break;
|
|
619
624
|
this.routeOwnerCache.delete(oldest);
|
|
620
625
|
}
|
|
621
626
|
}
|
|
@@ -2273,9 +2278,8 @@ var DedupManager = class {
|
|
|
2273
2278
|
this.accepted += 1;
|
|
2274
2279
|
this.windowAccepted += 1;
|
|
2275
2280
|
this.trace.recordDedupAccepted();
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
if (oldest === void 0) break;
|
|
2281
|
+
for (const oldest of this.seenMessageIds.keys()) {
|
|
2282
|
+
if (this.seenMessageIds.size <= this.maxEntries) break;
|
|
2279
2283
|
this.seenMessageIds.delete(oldest);
|
|
2280
2284
|
}
|
|
2281
2285
|
return false;
|
|
@@ -2336,7 +2340,7 @@ var DedupManager = class {
|
|
|
2336
2340
|
};
|
|
2337
2341
|
|
|
2338
2342
|
// src/core/version.ts
|
|
2339
|
-
var SDK_VERSION = true ? "0.20.
|
|
2343
|
+
var SDK_VERSION = true ? "0.20.95" : "";
|
|
2340
2344
|
|
|
2341
2345
|
// src/core/data-bus.ts
|
|
2342
2346
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -3528,4 +3532,4 @@ export {
|
|
|
3528
3532
|
parseDataBusPublication,
|
|
3529
3533
|
selectWorkerBackend
|
|
3530
3534
|
};
|
|
3531
|
-
//# sourceMappingURL=chunk-
|
|
3535
|
+
//# sourceMappingURL=chunk-7BPB2Y4E.js.map
|