-
Notifications
You must be signed in to change notification settings - Fork 0
/
service-worker.js
1 lines (1 loc) · 1.84 KB
/
service-worker.js
1
!function(){"use strict";const e=1685431992724,t="cache"+e,s=["/client/client.45ac517a.js","/client/inject_styles.5607aec6.js","/client/index.f0bbd5d4.js","/client/privacy-policy.3a0a7284.js","/client/import-export.fbe3abd4.js","/client/database.b99f8388.js","/client/terms-of-use.fff48455.js","/client/add-words.f0122e52.js","/client/contact.f840158c.js","/client/support.fe164b30.js","/client/review.714e63ff.js","/client/refresh.a2d7273e.js","/client/about.b0179f3a.js","/client/learn.40ac045b.js","/client/dexie-export-import.336226b2.js"].concat(["/service-worker-index.html","/collections/en-jp_1-15.json","/collections/jp-en_hiragana.json","/collections/jp-en_katakana.json","/favicon.ico","/global.css","/img/book.svg","/img/dark-mode-preview.png","/img/light-mode-preview.png","/img/profile.jpg","/logo/dexie-dm.svg","/logo/dexie.svg","/logo/discord.svg","/logo/sapper-dm.svg","/logo/sapper.svg","/logo/steam.svg","/logo/svelte-dm.svg","/logo/svelte.svg","/logo-192.png","/logo-512.png","/manifest.json"]),n=new Set(s);self.addEventListener("install",(e=>{e.waitUntil(caches.open(t).then((e=>e.addAll(s))).then((()=>{self.skipWaiting()})))})),self.addEventListener("activate",(e=>{e.waitUntil(caches.keys().then((async e=>{for(const s of e)s!==t&&await caches.delete(s);self.clients.claim()})))})),self.addEventListener("fetch",(t=>{if("GET"!==t.request.method||t.request.headers.has("range"))return;const s=new URL(t.request.url),o=s.protocol.startsWith("http"),c=s.hostname===self.location.hostname&&s.port!==self.location.port,a=s.host===self.location.host&&n.has(s.pathname),i="only-if-cached"===t.request.cache&&!a;!o||c||i||t.respondWith((async()=>a&&await caches.match(t.request)||async function(t){const s=await caches.open("offline"+e);try{const e=await fetch(t);return s.put(t,e.clone()),e}catch(e){const n=await s.match(t);if(n)return n;throw e}}(t.request))())}))}();