Merge remote-tracking branch 'remotes/upstream/develop' into tiles-start-positions
This commit is contained in:
commit
7f61e9addd
182 changed files with 17118 additions and 4494 deletions
16
front/src/Stores/VisibilityStore.ts
Normal file
16
front/src/Stores/VisibilityStore.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { readable } from "svelte/store";
|
||||
|
||||
/**
|
||||
* A store containing whether the current page is visible or not.
|
||||
*/
|
||||
export const visibilityStore = readable(document.visibilityState === "visible", function start(set) {
|
||||
const onVisibilityChange = () => {
|
||||
set(document.visibilityState === "visible");
|
||||
};
|
||||
|
||||
document.addEventListener("visibilitychange", onVisibilityChange);
|
||||
|
||||
return function stop() {
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange);
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue