diff options
Diffstat (limited to 'js/app.js')
-rw-r--r-- | js/app.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,12 @@ if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") - .then(() => {}) + .then(() => { }) .catch((err) => console.log("Service worker registration failed", err)); -}
\ No newline at end of file +} + +// Listen to messages from service workers. +navigator.serviceWorker.addEventListener('message', (event) => { + if (event.data.msg === "install") { + window.location.replace("/index.html"); + } +});
\ No newline at end of file |