1const CACHE = 'dcg-pwa-v1'; 2const STATIC = ['/app', '/logo.png', '/manifest.json']; 3 4self.addEventListener('install', e => { 5 e.waitUntil(caches.open(CACHE).then(c => c.addAll(STATIC))); 6 self.skipWaiting(); 7}); 8 9self.addEventListener('activate', e => { 10 e.waitUntil( 11 caches.keys().then(keys => 12 Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k))) 13 ) 14 ); 15 self.clients.claim(); 16}); 17 18self.addEventListener('fetch', e => { 19 if (e.request.method !== 'GET') return; 20 e.respondWith( 21 fetch(e.request) 22 .then(res => { 23 const clone = res.clone(); 24 caches.open(CACHE).then(c => c.put(e.request, clone)); 25 return res; 26 }) 27 .catch(() => caches.match(e.request)) 28 ); 29});
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.