cross-tab-worker-databus 0.20.93 → 0.20.94

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.
@@ -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]) listener(event_);
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;
@@ -2336,7 +2342,7 @@ var DedupManager = class {
2336
2342
  };
2337
2343
 
2338
2344
  // src/core/version.ts
2339
- var SDK_VERSION = true ? "0.20.93" : "";
2345
+ var SDK_VERSION = true ? "0.20.94" : "";
2340
2346
 
2341
2347
  // src/core/data-bus.ts
2342
2348
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
@@ -3528,4 +3534,4 @@ export {
3528
3534
  parseDataBusPublication,
3529
3535
  selectWorkerBackend
3530
3536
  };
3531
- //# sourceMappingURL=chunk-OXEPZGXR.js.map
3537
+ //# sourceMappingURL=chunk-RTTTA6JS.js.map