1/* eslint no-undef: 0 */ 2 3importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'); 4 5if (workbox) { 6 // Precaching 7 const OFFLINE_FALLBACK = '/offline.html'; 8 workbox.precaching.precacheAndRoute([{ url: OFFLINE_FALLBACK, revision: 'v9' }]); 9 10 // Images 11 workbox.routing.registerRoute( 12 /https:\/\/uma-penca\.imgix\.net.*/, 13 new workbox.strategies.StaleWhileRevalidate({ 14 // Use a custom cache name 15 cacheName: 'imgix-uma-penca-cache', 16 plugins: [ 17 new workbox.cacheableResponse.CacheableResponsePlugin({ 18 statuses: [0, 200], 19 }), 20 new workbox.expiration.ExpirationPlugin({ 21 maxAgeSeconds: 7 * 24 * 60 * 60, 22 purgeOnQuotaError: true, 23 }), 24 ], 25 }) 26 ); 27 28 // Js, CSS e Fonts 29 workbox.routing.registerRoute( 30 /https:\/\/(?:dmedtey819y2a|d3m65xlfrq0b3j|d1p2aep1hku8zv|fonts\.gstatic).*\.(?:js|css|gif|woff2|woff|eot|ttf)$/, 31 new workbox.strategies.StaleWhileRevalidate({ 32 cacheName: 'scripts-css-gifs-fonts', 33 plugins: [ 34 new workbox.cacheableResponse.CacheableResponsePlugin({ 35 statuses: [0, 200], 36 }), 37 new workbox.expiration.ExpirationPlugin({ 38 // Cache for a maximum of a week 39 maxAgeSeconds: 7 * 24 * 60 * 60, 40 purgeOnQuotaError: true, 41 }), 42 ], 43 }) 44 ); 45 46 // Offline Callback 47 const siteHandler = new workbox.strategies.NetworkOnly({ 48 cacheName: 'offline-cache', 49 }); 50 workbox.routing.registerRoute( 51 /(?:http|https):\/\/umapenca\.(?:com|site)(?!\/admin|.*?\.php)/, 52 function (event) { 53 return siteHandler.handle(event).catch(function () { 54 return caches.match(workbox.precaching.getCacheKeyForURL(OFFLINE_FALLBACK)); 55 }); 56 } 57 ); 58}
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.