main
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
const CACHE_NAME = 'sulfur-cache-v3';
|
||||
const urlsToCache = [
|
||||
'./index.html',
|
||||
'./css/style.css',
|
||||
'./js/launcher.js',
|
||||
'./manifest.json',
|
||||
'./instances/sulfur.html',
|
||||
'./assets/icon-192.png',
|
||||
'./assets/icon-512.png',
|
||||
'./assets/favicon.png',
|
||||
'./assets/bg-atm10.jpg',
|
||||
'./assets/bg-vanilla8.jpg',
|
||||
'./assets/thumb-atm10.png',
|
||||
'./assets/thumb-vanilla8.png'
|
||||
];
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
self.skipWaiting();
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME).then(cache => cache.addAll(urlsToCache))
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
event.waitUntil(
|
||||
caches.keys().then(keys =>
|
||||
Promise.all(keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)))
|
||||
)
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
event.respondWith(
|
||||
caches.match(event.request).then(response => response || fetch(event.request))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user