peerStore loading order caused issues. Fixed in GameScene (+ extracted a few stores in their files)

This commit is contained in:
David Négrier 2021-06-24 11:54:09 +02:00
parent 6ed8ce9af1
commit 2f282e3469
6 changed files with 57 additions and 55 deletions

View 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);
};
});