forked from aazahrou/infosecravindra.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw.js
1 lines (1 loc) · 749 Bytes
/
sw.js
1
var CACHE_NAME="2019-11-07T01:53:06+05:30",urlsToCache=["/assets/images/favicon/logo.webp"];self.addEventListener("install",function(e){e.waitUntil(caches.open(CACHE_NAME).then(function(e){return console.log("Opened cache"),e.addAll(urlsToCache)}))}),self.addEventListener("fetch",function(t){t.respondWith(caches.match(t.request).then(function(e){return e||fetch(t.request).then(function(e){if(!e||200!==e.status||"basic"!==e.type)return e;var n=e.clone();return caches.open(CACHE_NAME).then(function(e){e.put(t.request,n)}),e})}))}),self.addEventListener("activate",function(e){var n=["2019-11-07T01:53:06+05:30"];e.waitUntil(caches.keys().then(function(e){return Promise.all(e.map(function(e){if(-1===n.indexOf(e))return caches.delete(e)}))}))});