-
-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also remove the legacy fallback for browsers without StorageManager. Reason: It only applied to Safari<16 but those versions of safari had buggy storage implementations of localStorage anyway.
- Loading branch information
1 parent
a032bf4
commit 46b2903
Showing
5 changed files
with
57 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { connections } from "./globals/constants"; | ||
import { RangeSet } from "./helpers/rangeset"; | ||
import { bc, createBC } from "./live-query/enable-broadcast"; | ||
import { propagateLocally } from "./live-query/propagate-locally"; | ||
|
||
|
||
if (typeof addEventListener !== 'undefined') { | ||
addEventListener('pagehide', (event) => { | ||
if (event.persisted) { | ||
bc?.close(); | ||
} | ||
for (const db of connections) { | ||
db.close({disableAutoOpen: false}); | ||
} | ||
}); | ||
addEventListener('pageshow', (event) => { | ||
if (event.persisted) { | ||
createBC(); | ||
propagateLocally({all: new RangeSet(-Infinity, [[]])}); // Trigger all queries to requery | ||
} | ||
}); | ||
} |