1
0
mirror of https://github.com/comatory/fb2iCal synced 2024-12-27 08:52:58 +01:00
Facebook-Events-iCal-Converter/lib/public/service-worker.js
2019-11-24 22:39:50 +01:00

32 lines
622 B
JavaScript

// Worker v14
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('fb-to-ical').then((cache) => {
return cache.addAll([
'/',
'/favicon.ico',
'/scripts.js?6',
'/style.css?9',
'/about?3',
'/icon-512.png',
])
})
)
})
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request)
.then((response) => {
return response || fetch(event.request)
})
)
})
self.addEventListener('message', (event) => {
if (event.data.action === 'skipWaiting') {
self.skipWaiting()
}
})