2021-07-18 16:53:18 +02:00
|
|
|
const VERSION = '1.18.7';
|
2019-09-28 20:36:26 +02:00
|
|
|
|
2020-06-06 17:19:05 +02:00
|
|
|
self.addEventListener('install', (event) =>
|
2019-09-28 20:36:26 +02:00
|
|
|
event.waitUntil(
|
2020-06-06 17:19:05 +02:00
|
|
|
caches.open('v1').then((cache) =>
|
|
|
|
fetch('.?v=' + VERSION).then((response) => {
|
2019-09-28 20:36:26 +02:00
|
|
|
if (response.ok) {
|
|
|
|
return cache.put('.', response);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-06-06 17:19:05 +02:00
|
|
|
self.addEventListener('fetch', (event) => {
|
2019-09-28 20:36:26 +02:00
|
|
|
event.respondWith(
|
2020-06-06 17:19:05 +02:00
|
|
|
caches.match(event.request.url).then((response) => response || fetch(event.request))
|
2019-09-28 20:36:26 +02:00
|
|
|
);
|
|
|
|
});
|