23 lines
639 B
JavaScript
23 lines
639 B
JavaScript
![]() |
self.addEventListener('install', function (event) {
|
||
|
event.waitUntil(
|
||
|
caches.open('my-cache').then(function (cache) {
|
||
|
return cache.addAll([
|
||
|
'/',
|
||
|
'/index.html',
|
||
|
'/static/styles.css',
|
||
|
'/static/script.js',
|
||
|
'/static/icons/icon-192x192.png',
|
||
|
'/static/icons/icon-512x512.png'
|
||
|
]);
|
||
|
})
|
||
|
);
|
||
|
});
|
||
|
|
||
|
self.addEventListener('fetch', function (event) {
|
||
|
event.respondWith(
|
||
|
caches.match(event.request).then(function (response) {
|
||
|
return response || fetch(event.request);
|
||
|
})
|
||
|
);
|
||
|
});
|