mirror of
https://github.com/comatory/fb2iCal
synced 2024-12-28 17:30:51 +01:00
32 lines
622 B
JavaScript
32 lines
622 B
JavaScript
// Worker v13
|
|
|
|
self.addEventListener('install', (event) => {
|
|
event.waitUntil(
|
|
caches.open('fb-to-ical').then((cache) => {
|
|
return cache.addAll([
|
|
'/',
|
|
'/favicon.ico',
|
|
'/scripts.js?5',
|
|
'/style.css?8',
|
|
'/about?2',
|
|
'/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()
|
|
}
|
|
})
|