mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
installation module
This commit is contained in:
parent
e2e4f6dee2
commit
6a6264e21c
5 changed files with 84 additions and 7 deletions
11
main.js
11
main.js
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue