代码拉取完成,页面将自动刷新
var staticCacheName = "pwa-v" + new Date().getTime();
var filesToCache = [
'public/img/icons/akaunting-72x72.png',
'public/img/icons/akaunting-96x96.png',
'public/img/icons/akaunting-128x128.png',
'public/img/icons/akaunting-144x144.png',
'public/img/icons/akaunting-152x152.png',
'public/img/icons/akaunting-192x192.png',
'public/img/icons/akaunting-384x384.png',
'public/img/icons/akaunting-512x512.png'
];
/*
// Cache on install
self.addEventListener("install", event => {
this.skipWaiting();
event.waitUntil(
caches.open(staticCacheName)
.then(cache => {
return cache.addAll(filesToCache);
})
)
});
*/
/*
// Clear cache on activate
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames
.filter(cacheName => (cacheName.startsWith("pwa-")))
.filter(cacheName => (cacheName !== staticCacheName))
.map(cacheName => caches.delete(cacheName))
);
})
);
});*/
// Serve from Cache
self.addEventListener("fetch", event => {
event.respondWith(
caches.match(event.request)
.then(response => {
return response || fetch(event.request);
})
.catch(() => {
return caches.match('offline');
})
)
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。