-
Notifications
You must be signed in to change notification settings - Fork 0
/
service-worker.js
1 lines (1 loc) · 1.6 KB
/
service-worker.js
1
!function(){"use strict";const s=1605573903801,e="cache"+s,n=["/client/client.3c7f51c5.js","/client/inject_styles.5607aec6.js","/client/index.f65efc93.js"].concat(["/service-worker-index.html","/fav.png","/global.css","/imgs/1-1.jpg","/imgs/1-2.jpg","/imgs/1-3.jpg","/imgs/1-4.jpg","/imgs/i-2.jpg","/imgs/i-3.jpg","/imgs/icons/cart/cart-buying.png","/imgs/icons/cart/cart.png","/imgs/icons/checkout.png","/imgs/icons/email.png","/imgs/icons/free-shipping.png","/imgs/icons/location.png","/imgs/icons/online-support.png","/imgs/icons/phone.png","/imgs/icons/profile.png","/imgs/icons/returns.png","/imgs/icons/search.png","/imgs/icons/secure-payment.png","/imgs/s-1.jpg","/imgs/s-2.jpg","/imgs/s-3.jpg","/logo-192.png","/logo-512.png","/manifest.json","/s_logo.png"]),t=new Set(n);self.addEventListener("install",(s=>{s.waitUntil(caches.open(e).then((s=>s.addAll(n))).then((()=>{self.skipWaiting()})))})),self.addEventListener("activate",(s=>{s.waitUntil(caches.keys().then((async s=>{for(const n of s)n!==e&&await caches.delete(n);self.clients.claim()})))})),self.addEventListener("fetch",(e=>{if("GET"!==e.request.method||e.request.headers.has("range"))return;const n=new URL(e.request.url),i=n.protocol.startsWith("http"),c=n.hostname===self.location.hostname&&n.port!==self.location.port,o=n.host===self.location.host&&t.has(n.pathname),a="only-if-cached"===e.request.cache&&!o;!i||c||a||e.respondWith((async()=>o&&await caches.match(e.request)||async function(e){const n=await caches.open("offline"+s);try{const s=await fetch(e);return n.put(e,s.clone()),s}catch(s){const t=await n.match(e);if(t)return t;throw s}}(e.request))())}))}();