EUR-DZD_currency_converter/service-worker.js

27 lines
561 B
JavaScript
Raw Normal View History

2024-04-09 09:29:48 +02:00
const CACHE_NAME = 'eur-dzd-calculator-v1';
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open(CACHE_NAME)
.then(function(cache) {
return cache.addAll([
'/index.html',
'/manifest.json',
'/icon.png',
]);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
if (response) {
return response;
}
return fetch(event.request);
})
);
});