的胜利开工了咖啡馆的快乐
var cacheName = 'fengerzh'; var filesToCache = [ '/', '/index.html', '/assets/js/main.js', '/assets/css/main.css', '/assets/img/placeholder.png', '/assets/img/icons/preloader.svg', '/assets/img/icons/read.svg', ]; self.addEventListener('install', function(e) { e.waitUntil( caches.open(cacheName).then(function(cache) { return cache.addAll(filesToCache); }) ); }); self.addEventListener('activate', function(e) { e.waitUntil( caches.keys().then(function(keyList) { return Promise.all(keyList.map(function(key) { if (key !== cacheName) { return caches.delete(key); } })); }) ); return self.clients.claim(); }); self.addEventListener('fetch', function(e) { e.respondWith( caches.match(e.request).then(function(response) { return response || fetch(e.request); }) ); });