Welcome to the New Wiki
Please let us know if anything looks out of place.
MediaWiki:PWA-Walkscape Wiki-serviceWorker.js: Difference between revisions
From Walkscape Walkthrough
Created page with "self.addEventListener("install", event => { console.log("Service worker installed"); }); self.addEventListener("activate", event => { console.log("Service worker activated"); }); self.addEventListener("fetch", event => { console.log("Service worker fetch"); });" |
No edit summary |
||
Line 2: | Line 2: | ||
console.log("Service worker installed"); | console.log("Service worker installed"); | ||
}); | }); | ||
self.addEventListener("activate", event => { | self.addEventListener("activate", event => { | ||
console.log("Service worker activated"); | console.log("Service worker activated"); | ||
}); | }); | ||
self.addEventListener( | |||
self.addEventListener('fetch', (event) => { | |||
event.respondWith( | |||
caches.match(event.request).then((response) => { | |||
return response || fetch(event.request); | |||
}) | |||
); | |||
}); | }); |
Latest revision as of 07:23, 8 January 2025
self.addEventListener("install", event => {
console.log("Service worker installed");
});
self.addEventListener("activate", event => {
console.log("Service worker activated");
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
});