1importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js"); 2if (workbox) { (function(){ 3 4 var prefix = "octopus"; 5 var suffix = "1.0.0"; 6 var mode = "production"; 7 8 function cn(x) { 9 return (prefix + "-" + x + "-" + suffix); 10 } 11 12 workbox.setConfig({ debug: ( mode === "development" ? true : false ) }); 13 14 workbox.core.setCacheNameDetails({ 15 prefix: prefix, 16 suffix: suffix 17 }); 18 19 workbox.routing.registerRoute( 20 new RegExp("https://fonts.(?:googleapis|gstatic).com/(.*)"), 21 workbox.strategies.cacheFirst({ 22 cacheName: cn("googleapis"), 23 plugins: [ 24 new workbox.expiration.Plugin({ 25 maxEntries: 32 26 }), 27 new workbox.cacheableResponse.Plugin({ 28 statuses: [0, 200], 29 }) 30 ] 31 }) 32 ); 33 34 workbox.routing.registerRoute( 35 new RegExp("https://cdnjs.cloudflare.com/ajax/libs/(.*)"), 36 workbox.strategies.cacheFirst({ 37 cacheName: cn("cloudflare"), 38 plugins: [ 39 new workbox.expiration.Plugin({ 40 maxEntries: 32 41 }), 42 new workbox.cacheableResponse.Plugin({ 43 statuses: [0, 200], 44 }) 45 ] 46 }) 47 ); 48 49 workbox.routing.registerRoute( 50 /\.(?:png|gif|jpg|jpeg|svg)$/, 51 workbox.strategies.cacheFirst({ 52 cacheName: cn("images"), 53 plugins: [ 54 new workbox.expiration.Plugin({ 55 maxEntries: 256, 56 maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days 57 }), 58 new workbox.cacheableResponse.Plugin({ 59 statuses: [0, 200], 60 }) 61 ] 62 }) 63 ); 64 65 workbox.routing.registerRoute( 66 /\.(?:js|css)$/, 67 workbox.strategies.staleWhileRevalidate({ 68 cacheName: cn("static"), 69 }) 70 ); 71 72}()) }
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.