Skip to content
Permalink
master
Switch branches/tags
Go to file
@ninofiliu
Latest commit 84e1288 Dec 27, 2020 History
2 contributors

Users who have contributed to this file

@chrisdavidmills @ninofiliu
21 lines (20 sloc) 629 Bytes
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open('fox-store').then((cache) => cache.addAll([
'/pwa-examples/a2hs/',
'/pwa-examples/a2hs/index.html',
'/pwa-examples/a2hs/index.js',
'/pwa-examples/a2hs/style.css',
'/pwa-examples/a2hs/images/fox1.jpg',
'/pwa-examples/a2hs/images/fox2.jpg',
'/pwa-examples/a2hs/images/fox3.jpg',
'/pwa-examples/a2hs/images/fox4.jpg',
])),
);
});
self.addEventListener('fetch', (e) => {
console.log(e.request.url);
e.respondWith(
caches.match(e.request).then((response) => response || fetch(e.request)),
);
});