2019-09-23 20:32:56 +02:00
|
|
|
const VERSION = '0.0.0';
|
|
|
|
|
2020-06-01 16:53:51 +02:00
|
|
|
self.addEventListener('install', (event) =>
|
2019-09-23 20:32:56 +02:00
|
|
|
event.waitUntil(
|
2020-06-01 16:53:51 +02:00
|
|
|
caches.open('v1').then((cache) =>
|
|
|
|
fetch('.?v=' + VERSION).then((response) => {
|
2019-09-23 20:32:56 +02:00
|
|
|
if (response.ok) {
|
2019-09-23 20:36:54 +02:00
|
|
|
return cache.put('.', response);
|
2019-09-23 20:32:56 +02:00
|
|
|
}
|
2019-09-23 20:36:54 +02:00
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2019-09-23 20:32:56 +02:00
|
|
|
|
2020-06-01 16:53:51 +02:00
|
|
|
self.addEventListener('fetch', (event) => {
|
2019-09-23 20:32:56 +02:00
|
|
|
event.respondWith(
|
2020-06-01 16:53:51 +02:00
|
|
|
caches.match(event.request.url).then((response) => response || fetch(event.request))
|
2019-09-23 20:32:56 +02:00
|
|
|
);
|
|
|
|
});
|