1const CACHE_NAME = 'gundam-cache-v1'; 2const urlsToCache = [ 3 '/', 4 '/styles/main-2.0.6.css', 5 '/scripts/common-1.0.7.js', 6 '/images/logo/favicon.png' 7]; 8 9// ì¤ì¹ ë¨ê³: ìºìì íì¼ ì ì¥ 10self.addEventListener('install', (event) => { 11 console.log('[SW] Service Worker installing...'); 12 event.waitUntil( 13 caches.open(CACHE_NAME) 14 .then((cache) => { 15 console.log('[SW] Caching app shell...'); 16 return cache.addAll(urlsToCache); 17 }) 18 ); 19}); 20 21// íì±í ë¨ê³: ì´ì ìºì ì 리 22self.addEventListener('activate', (event) => { 23 console.log('[SW] Service Worker activating...'); 24 event.waitUntil( 25 caches.keys().then((cacheNames) => { 26 return Promise.all( 27 cacheNames.filter((key) => key !== CACHE_NAME) 28 .map((key) => caches.delete(key)) 29 ); 30 }) 31 ); 32}); 33 34// fetch ìì² ê°ë¡ì±ê¸° 35self.addEventListener('fetch', (event) => { 36 const req = event.request; 37 38 // HTML 문ì ìì²ì ë¤í¸ìí¬ ì°ì ì²ë¦¬ 39 if (req.mode === 'navigate') { 40 event.respondWith( 41 fetch(req).catch(() => caches.match('/offline.html')) 42 ); 43 return; 44 } 45 46 // ê·¸ ì¸ ììì ìºì ì°ì ì²ë¦¬ 47 event.respondWith( 48 caches.match(req).then((cachedRes) => { 49 return cachedRes || fetch(req); 50 }) 51 ); 52});
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.