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