1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/keeweb_ynh.git synced 2024-09-03 19:26:33 +02:00
keeweb_ynh/sources/extra_files/app/service-worker.js
2021-09-07 13:28:42 +05:30

19 lines
503 B
JavaScript

const VERSION = '1.18.7';
self.addEventListener('install', (event) =>
event.waitUntil(
caches.open('v1').then((cache) =>
fetch('.?v=' + VERSION).then((response) => {
if (response.ok) {
return cache.put('.', response);
}
})
)
)
);
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request.url).then((response) => response || fetch(event.request))
);
});