1// å°ç£ç½ªç¯åé ç¶²é App èæ¯ç¨å¼ 2// ååï¼æç¶²è·¯ä¸å¾æææ°çï¼ç«é·å¸¸æ´æ°ï¼ä¸è½è®äººçå°èå¡çï¼ï¼åªææ·ç¶²ææç¨ä¸æ¬¡åä¸çé é¢ã 3const CACHE = 'metawilo-v1'; 4 5self.addEventListener('install', () => self.skipWaiting()); 6 7self.addEventListener('activate', (event) => { 8 event.waitUntil( 9 caches.keys() 10 .then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))) 11 .then(() => self.clients.claim()) 12 ); 13}); 14 15self.addEventListener('fetch', (event) => { 16 const req = event.request; 17 if (req.method !== 'GET') return; 18 const url = new URL(req.url); 19 if (url.origin !== self.location.origin) return; // ååãèæ¸çå¤é¨è³æºä¸èç 20 21 // åªèçé 颿¬èº«ï¼é¦é ãæ¡ä»¶é ã延伸é±è®ï¼ï¼åççç §å¸¸èµ°ç¶²è·¯ 22 if (req.mode !== 'navigate') return; 23 24 event.respondWith( 25 fetch(req) 26 .then((res) => { 27 if (res.ok) { 28 const copy = res.clone(); 29 caches.open(CACHE).then((c) => c.put(req, copy)); 30 } 31 return res; 32 }) 33 .catch(() => caches.match(req).then((hit) => hit || caches.match('/'))) 34 ); 35});
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.