18 lines
448 B
JavaScript
18 lines
448 B
JavaScript
// This is the "Offline copy of assets" service worker
|
|
|
|
const CACHE = "pwabuilder-offline";
|
|
|
|
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
|
|
|
|
self.addEventListener("message", (event) => {
|
|
if (event.data && event.data.type === "SKIP_WAITING") {
|
|
self.skipWaiting();
|
|
}
|
|
});
|
|
|
|
workbox.routing.registerRoute(
|
|
new RegExp('/*'),
|
|
new workbox.strategies.StaleWhileRevalidate({
|
|
cacheName: CACHE
|
|
})
|
|
); |