installation module

This commit is contained in:
Azgaar 2022-05-13 22:37:34 +03:00
parent e2e4f6dee2
commit 6a6264e21c
5 changed files with 84 additions and 7 deletions

11
main.js
View file

@ -10,13 +10,22 @@ const TIME = DEBUG || !PRODUCTION;
const WARN = true;
const ERROR = true;
// register service worker responsible for caching
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("./sw.js").catch(err => {
console.error("ServiceWorker registration failed: ", err);
});
});
window.addEventListener(
"beforeinstallprompt",
async event => {
event.preventDefault();
const Installation = await import("/modules/dynamic/installation.js");
Installation.init(event);
},
{once: true}
);
}
// append svg layers (in default order)