1importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.5.4/workbox-sw.js'); 2 3if (workbox) { 4 console.log("Workbox baÅarıyla yüklendi! ð"); 5 6 const OFFLINE_HTML = '/offline.html'; 7 8 workbox.precaching.precacheAndRoute([ 9 { url: OFFLINE_HTML, revision: 1 } 10 ]); 11 12 // Google Analytics DesteÄi 13 workbox.googleAnalytics.initialize(); 14 15 // Navigation preload'u etkinleÅtir 16 workbox.navigationPreload.enable(); 17 18 // Network-Only stratejisi ile sayfa yönlendirmeleri 19 workbox.routing.registerRoute( 20 ({ request }) => request.mode === 'navigate', 21 new workbox.strategies.NetworkOnly({ 22 plugins: [ 23 new workbox.cacheableResponse.CacheableResponsePlugin({ 24 statuses: [200] 25 }) 26 ] 27 }) 28 ); 29 30 // ÃevrimdıÅı sayfası sunma ve preload'u doÄru kullanma 31 self.addEventListener("fetch", (event) => { 32 if (event.request.mode === 'navigate') { 33 event.respondWith( 34 (async function () { 35 // Navigation preload yanıtını al 36 const preloadResponse = await event.preloadResponse; 37 38 if (preloadResponse) { 39 return preloadResponse; // EÄer preload yanıtı varsa bunu kullan 40 } 41 42 // İnternetten isteÄi yap, baÅarısız olursa OFFLINE_HTML kullan 43 try { 44 return await fetch(event.request); 45 } catch (error) { 46 return await caches.match(OFFLINE_HTML); 47 } 48 })() 49 ); 50 } 51 }); 52 53} else { 54 console.log("Workbox yüklenemedi. ð¢"); 55}
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.