1const OFFLINE_CACHE = 'offline-v1' 2const OFFLINE_URL = 'offline.html' 3 4self.addEventListener('install', e => { 5 e.waitUntil( 6 caches.open(OFFLINE_CACHE).then(cache => { 7 return cache.add( 8 new Request(OFFLINE_URL, { cache: 'reload' }) 9 ).then(() => self.skipWaiting()) 10 }) 11 ) 12}) 13 14self.addEventListener('activate', e => { 15 e.waitUntil(self.clients.claim()) 16}) 17 18self.addEventListener('fetch', e => { 19 const request = e.request 20 21 if (request.method === 'GET') { 22 e.respondWith( 23 fetch(request).catch(error => { 24 return caches.open(OFFLINE_CACHE).then(cache => cache.match(OFFLINE_URL)) 25 }) 26 ) 27 } 28})
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.