Facebook-Events-iCal-Converter/lib/public/service-worker.js

30 lines
576 B
JavaScript
Raw Normal View History

// Worker v3
2019-10-20 20:32:25 +02:00
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('fb-to-ical').then((cache) => {
return cache.addAll([
'/',
'/favicon.ico',
'/scripts.js?3',
'/style.css?3',
2019-10-20 20:32:25 +02:00
])
})
)
})
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()
}
})