fix service worker security issue

This commit is contained in:
bobsfriend12 2023-09-20 19:45:14 -05:00
parent 5615cc7938
commit 2a53c35df7

View File

@ -6,14 +6,18 @@ importScripts(
const CACHE = "crafty-controller";
//This service worker is basically just here to make browsers
//accept the PWA. It's not doing much anymore
// TODO: replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
const offlineFallbackPage = "/offline";
self.addEventListener("message", (event) => {
if (event.data && event.data.type === "SKIP_WAITING") {
self.skipWaiting();
}
});
// self.addEventListener("message", (event) => {
// console.log(event.data);
// if (event.data && event.data.type === "SKIP_WAITING") {
// self.skipWaiting();
// }
// });
if (workbox.navigationPreload.isSupported()) {
workbox.navigationPreload.enable();