Skip to content

Commit c921a2c

Browse files
committed
Resolve #1473
1 parent 7e34806 commit c921a2c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/live-query/enable-broadcast.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ if (typeof BroadcastChannel !== 'undefined') {
6060
//
6161
// Propagate remote changes locally via storage event:
6262
//
63-
addEventListener('storage', (ev: StorageEvent) => {
64-
if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {
65-
const data = JSON.parse(ev.newValue);
66-
if (data) propagateLocally(data.changedParts);
67-
}
68-
});
63+
if (typeof addEventListener !== 'undefined') {
64+
addEventListener('storage', (ev: StorageEvent) => {
65+
if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {
66+
const data = JSON.parse(ev.newValue);
67+
if (data) propagateLocally(data.changedParts);
68+
}
69+
});
70+
}
6971

7072
//
7173
// Propagate messages from service worker

0 commit comments

Comments
 (0)