1const CACHE_NAME = 'my-site-cache-v1'; 2const FILES_TO_CACHE = [ 3 '/', // root 4 '/index.html', 5 '/style.css', 6 '/script.js', 7 '/logo.png' 8]; 9 10// Install â cache files 11self.addEventListener('install', event => { 12 event.waitUntil( 13 caches.open(CACHE_NAME) 14 .then(cache => cache.addAll(FILES_TO_CACHE)) 15 ); 16}); 17 18// Fetch â serve from cache if available 19self.addEventListener('fetch', event => { 20 event.respondWith( 21 caches.match(event.request) 22 .then(response => response || fetch(event.request)) 23 ); 24});
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.