tracman-server/static/js/.sw.min.js

1 line
894 B
JavaScript

"use strict";const PRECACHE="precache-0.8.2",RUNTIME="runtime",PRECACHE_URLS=["/","/static/js/.*.min.js","/static/css/.*.min.css","/static/manifest.json"];self.addEventListener("install",function(t){t.waitUntil(caches.open(PRECACHE).then(function(t){t.addAll(PRECACHE_URLS)}).then(self.skipWaiting()))}),self.addEventListener("activate",function(t){const n=[PRECACHE,RUNTIME];t.waitUntil(caches.keys().then(function(t){return t.filter(function(t){n.includes(t)})}).then(function(t){return Promise.all(t.map(function(t){return caches.delete(t)}))}).then(function(){self.clients.claim()}))}),self.addEventListener("fetch",function(t){t.request.url.startsWith(self.location.origin)&&t.respondWith(caches.match(t.request).then(function(n){return n||caches.open(RUNTIME).then(function(n){return fetch(t.request).then(function(e){return n.put(t.request,e.clone()).then(function(){return e})})})}))});