-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
1 lines (1 loc) · 664 Bytes
/
sw.js
File metadata and controls
1 lines (1 loc) · 664 Bytes
1
"use strict";!function(){importScripts("https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js");self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),self.addEventListener("install",async e=>{e.waitUntil(caches.open("cached-page").then(e=>e.add("/index.html")))}),workbox.navigationPreload.isSupported()&&workbox.navigationPreload.enable(),self.addEventListener("fetch",e=>{"navigate"===e.request.mode&&e.respondWith((async()=>{try{const t=await e.preloadResponse;if(t)return t;return await fetch(e.request)}catch(e){const t=await caches.open("cached-page");return await t.match("/index.html")}})())})}();