-
Notifications
You must be signed in to change notification settings - Fork 0
/
service-worker.js
1 lines (1 loc) · 3.58 KB
/
service-worker.js
1
"use strict";var precacheConfig=[["/burger-builder-react-redux/index.html","3455b79bcd59a8a1a2d36b9e5d72e95d"],["/burger-builder-react-redux/static/css/main.78d78559.css","4fd02260134d3cd55d2c67bfad64efcb"],["/burger-builder-react-redux/static/js/0.011c730c.chunk.js","0e78348f0c7513bf3afd2ee08e7e12d4"],["/burger-builder-react-redux/static/js/1.ec7b5f21.chunk.js","d92f1f8d060137538b0ce52d4c6babad"],["/burger-builder-react-redux/static/js/2.2a2bb11d.chunk.js","b19fe2f5031aa9d9ba83d92caf0b18f5"],["/burger-builder-react-redux/static/js/main.9d4658f3.js","15bd85fa638eca13ef181caa0fe49aed"],["/burger-builder-react-redux/static/media/burger-logo.b8503d26.png","b8503d262bffbfb7c67fd6762963e7d1"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,r){var t=new URL(e);return"/"===t.pathname.slice(-1)&&(t.pathname+=r),t.toString()},cleanResponse=function(r){return r.redirected?("body"in r?Promise.resolve(r.body):r.blob()).then(function(e){return new Response(e,{headers:r.headers,status:r.status,statusText:r.statusText})}):Promise.resolve(r)},createCacheKey=function(e,r,t,n){var a=new URL(e);return n&&a.pathname.match(n)||(a.search+=(a.search?"&":"")+encodeURIComponent(r)+"="+encodeURIComponent(t)),a.toString()},isPathWhitelisted=function(e,r){if(0===e.length)return!0;var t=new URL(r).pathname;return e.some(function(e){return t.match(e)})},stripIgnoredUrlParameters=function(e,t){var r=new URL(e);return r.hash="",r.search=r.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(r){return t.every(function(e){return!e.test(r[0])})}).map(function(e){return e.join("=")}).join("&"),r.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var r=e[0],t=e[1],n=new URL(r,self.location),a=createCacheKey(n,hashParamName,t,/\.\w{8}\./);return[n.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(n){return setOfCachedUrls(n).then(function(t){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(r){if(!t.has(r)){var e=new Request(r,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+r+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return n.put(r,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var t=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(r){return r.keys().then(function(e){return Promise.all(e.map(function(e){if(!t.has(e.url))return r.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(r){if("GET"===r.request.method){var e,t=stripIgnoredUrlParameters(r.request.url,ignoreUrlParametersMatching),n="index.html";(e=urlsToCacheKeys.has(t))||(t=addDirectoryIndex(t,n),e=urlsToCacheKeys.has(t));var a="/burger-builder-react-redux/index.html";!e&&"navigate"===r.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],r.request.url)&&(t=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(t)),e&&r.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(t)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',r.request.url,e),fetch(r.request)}))}});