1/* ALIMA beta 0.6.14: network-first updates, offline shell only. */ 2'use strict'; 3const CACHE='alima-beta-shell-v0614'; 4const SHELL=['./index.html','./styles.css?v=0.6.14','./app.js?v=0.6.14','./manifest.webmanifest','./icons/favicon.svg','./icons/icon-192.png','./icons/icon-512.png','./icons/apple-touch-icon.png?v=0.6.14']; 5self.addEventListener('install',event=>{event.waitUntil(caches.open(CACHE).then(cache=>cache.addAll(SHELL)).then(()=>self.skipWaiting()));}); 6self.addEventListener('activate',event=>{event.waitUntil(caches.keys().then(keys=>Promise.all(keys.filter(k=>k.startsWith('alima-beta-shell-')&&k!==CACHE).map(k=>caches.delete(k)))).then(()=>self.clients.claim()));}); 7self.addEventListener('fetch',event=>{ 8 const req=event.request;if(req.method!=='GET')return; 9 const url=new URL(req.url);if(url.origin!==self.location.origin)return; 10 if(url.pathname.includes('/wp-json/')||!url.pathname.startsWith(new URL(self.registration.scope).pathname))return; 11 const isAppShell=req.mode==='navigate'||/\.(?:html|css|js)$/.test(url.pathname); 12 if(isAppShell){event.respondWith(fetch(req,{cache:'no-store'}).then(response=>{ 13 if(response.ok){const copy=response.clone();event.waitUntil(caches.open(CACHE).then(c=>c.put(req,copy)));} 14 return response; 15 }).catch(async()=>await caches.match(req)||(req.mode==='navigate'?await caches.match('./index.html'):Response.error())));return;} 16 event.respondWith(caches.match(req).then(cached=>cached||fetch(req))); 17});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.