-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice-worker.js
1 lines (1 loc) · 1.23 KB
/
service-worker.js
1
!function(){"use strict";const t=1611255561859,e=`cache${t}`,n=["/client/client.2b53d96c.js","/client/inject_styles.5607aec6.js","/client/index.aaddb018.js"].concat(["/service-worker-index.html","/favicon.jpg","/fonts/OFL.txt","/fonts/gentiumbasic-regular-webfont.woff","/fonts/gentiumbasic-regular-webfont.woff2","/global.css","/images/background.jpg","/logo.jpg","/manifest.json"]),s=new Set(n);self.addEventListener("install",(t=>{t.waitUntil(caches.open(e).then((t=>t.addAll(n))).then((()=>{self.skipWaiting()})))})),self.addEventListener("activate",(t=>{t.waitUntil(caches.keys().then((async t=>{for(const n of t)n!==e&&await caches.delete(n);self.clients.claim()})))})),self.addEventListener("fetch",(e=>{if("GET"!==e.request.method||e.request.headers.has("range"))return;const n=new URL(e.request.url),a=n.protocol.startsWith("http"),c=n.hostname===self.location.hostname&&n.port!==self.location.port,o=n.host===self.location.host&&s.has(n.pathname),i="only-if-cached"===e.request.cache&&!o;!a||c||i||e.respondWith((async()=>o&&await caches.match(e.request)||async function(e){const n=await caches.open(`offline${t}`);try{const t=await fetch(e);return n.put(e,t.clone()),t}catch(t){const s=await n.match(e);if(s)return s;throw t}}(e.request))())}))}();