File size: 462 Bytes
e884e78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | const CACHE_NAME = "notesync-cache-v1";
const urlsToCache = [
"./",
"./index.html",
"./manifest.json",
"./sw.js",
"./icon-192.png",
"./icon-512.png"
];
self.addEventListener("install", event => {
event.waitUntil(
caches.open(CACHE_NAME).then(cache => cache.addAll(urlsToCache))
);
});
self.addEventListener("fetch", event => {
event.respondWith(
caches.match(event.request).then(response => response || fetch(event.request))
);
});
|