@plurid/joiner
Version:
Multi/Mono-Repository Task Runner
1 lines • 843 B
JavaScript
const CACHE_NAME_STATIC="static-v1",CACHE_URLS_STATIC=["/favicon.ico","/icon-192x192.png","/icon-512x512.png","manifest.json","/vendor.js","/index.js"],CACHE_NAME_ROUTES="routes-v1",CACHE_URLS_ROUTES=["/"];self.addEventListener("install",(t=>{t.waitUntil(async function(){const t=await caches.open("static-v1");await t.addAll(CACHE_URLS_STATIC);const a=await caches.open("routes-v1");await a.addAll(CACHE_URLS_ROUTES)}())})),self.addEventListener("activate",(t=>{t.waitUntil(async function(){const t=await caches.keys();await Promise.all(t.filter((t=>{})).map((t=>caches.delete(t))))}())})),self.addEventListener("fetch",(t=>{t.respondWith(async function(){const a=await caches.open("static-v1"),e=await a.match(t.request);if(e)return e;const n=await caches.open("routes-v1"),s=await n.match(t.request);return s||await fetch(t.request)}())}));