23 lines
545 B
JavaScript
23 lines
545 B
JavaScript
// public/service-worker.js
|
|
self.addEventListener('install', event => {
|
|
event.waitUntil(
|
|
caches.open('sociowire-v1').then(cache => {
|
|
return cache.addAll([
|
|
'/',
|
|
'/index.html',
|
|
'/icons/icon-192x192.png',
|
|
'/icons/icon-512x512.png',
|
|
'/icons/apple-touch-icon.png',
|
|
'/icons/og-image.png'
|
|
]);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', event => {
|
|
event.respondWith(
|
|
caches.match(event.request).then(response => {
|
|
return response || fetch(event.request);
|
|
})
|
|
);
|
|
}); |