diff --git a/src/main/resources/web/js/page.js b/src/main/resources/web/js/page.js index e8eb431..31af965 100644 --- a/src/main/resources/web/js/page.js +++ b/src/main/resources/web/js/page.js @@ -13,13 +13,13 @@ window.addEventListener('beforeinstallprompt', e => { // On load $(() => { if (navigator.serviceWorker) { - navigator.serviceWorker.register("sw.js") - .then(it => navigator.serviceWorker.ready.then(ready => ready.postMessage({ - action: "cache", - urls: performance.getEntriesByType("resource") - .map(it => it.name) - .filter(it => it.endsWith(".js") || it.endsWith(".css") || it.endsWith(".png")) - }))); // https://stackoverflow.com/questions/46830493/is-there-any-way-to-cache-all-files-of-defined-folder-path-in-service-worker + navigator.serviceWorker.register("sw.js"); + navigator.serviceWorker.ready.then(ready => ready.active.postMessage({ + action: "cache", + urls: performance.getEntriesByType("resource") + .map(it => it.name) + .filter(it => it.endsWith(".js") || it.endsWith(".css") || it.endsWith(".png")) + })); // https://stackoverflow.com/questions/46830493/is-there-any-way-to-cache-all-files-of-defined-folder-path-in-service-worker } ohNo();