Skip to content

Commit

Permalink
each broadcast must be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Feb 13, 2025
1 parent 3a2d9ba commit 36b0433
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/background/broadcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function broadcast(data) {
}

function doBroadcast() {
toBroadcast.push(Math.random());
(chromeSession || chromeLocal).set({[kBroadcast]: toBroadcast});
toBroadcast = null;
}
Expand Down
1 change: 1 addition & 0 deletions src/js/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async function onStorage(changes) {
if ((changes = changes[kBroadcast]) && (changes = changes.newValue)) {
if (document.visibilityState !== 'visible')
await new Promise(setTimeout);
changes.pop();
onRuntimeMessage({data: changes, multi: true}, {}, wrapData);
}
}

0 comments on commit 36b0433

Please sign in to comment.