Files
the-nexus/service-worker.js

27 lines
542 B
JavaScript
Raw Normal View History

const CACHE_NAME = 'nexus-v1.1';
const ASSETS_TO_CACHE = [
'/',
'/index.html',
'/app.js',
'/style.css',
'/manifest.json',
'/icons/icon-192x192.png',
'/icons/icon-512x512.png'
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CachedName).then(cache => {
return cache.addAll(ASSETS_TO_CACHE);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then(response => {
return response || fetch(event.request);
})
);
});