summaryrefslogtreecommitdiffstats
path: root/js/app.js
blob: 97e671fc19f6f486e794f6ee044c9583c98b0cf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
if ("serviceWorker" in navigator) {
    navigator.serviceWorker.register("/sw.js")
        .then(() => { })
        .catch((err) => console.log("Service worker registration failed", err));
}

// Listen to messages from service workers.
navigator.serviceWorker.addEventListener('message', (event) => {
    if (event.data.msg === "install") {
        window.location.replace("/index.html");
    }
});