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.
@@ -184,6 +184,7 @@ function createStorageEventChannel(options) {
184
184
  if (!storage || !win) return null;
185
185
  const key = `${STORAGE_CHANNEL_PREFIX}${name}`;
186
186
  const listeners = /* @__PURE__ */ new Set();
187
+ const senderId = randomId();
187
188
  let sequence = 0;
188
189
  const onStorage = (event) => {
189
190
  if (event.key !== key || event.newValue === null) return;
@@ -196,7 +197,12 @@ function createStorageEventChannel(options) {
196
197
  return;
197
198
  }
198
199
  const event_ = { data: message };
199
- for (const listener of [...listeners]) listener(event_);
200
+ for (const listener of [...listeners]) {
201
+ try {
202
+ listener(event_);
203
+ } catch {
204
+ }
205
+ }
200
206
  };
201
207
  win.addEventListener("storage", onStorage);
202
208
  let closed = false;
@@ -210,7 +216,7 @@ function createStorageEventChannel(options) {
210
216
  postMessage(message) {
211
217
  if (closed) return;
212
218
  sequence += 1;
213
- storage.setItem(key, JSON.stringify({ seq: sequence, message }));
219
+ storage.setItem(key, JSON.stringify({ senderId, seq: sequence, message }));
214
220
  },
215
221
  close() {
216
222
  closed = true;
@@ -2464,7 +2470,7 @@ var DedupManager = class {
2464
2470
  };
2465
2471
 
2466
2472
  // src/core/version.ts
2467
- var SDK_VERSION = true ? "0.20.93" : "";
2473
+ var SDK_VERSION = true ? "0.20.94" : "";
2468
2474
 
2469
2475
  // src/core/data-bus.ts
2470
2476
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;