fix indentation and move registration
This commit is contained in:
@@ -33,28 +33,28 @@ const APP_STATIC_RESOURCES = [
|
||||
|
||||
// On install, cache the static resources
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const cache = await caches.open(CACHE_NAME);
|
||||
cache.addAll(APP_STATIC_RESOURCES);
|
||||
})(),
|
||||
);
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const cache = await caches.open(CACHE_NAME);
|
||||
cache.addAll(APP_STATIC_RESOURCES);
|
||||
})(),
|
||||
);
|
||||
});
|
||||
|
||||
// delete old caches on activate
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const names = await caches.keys();
|
||||
await Promise.all(
|
||||
names.map((name) => {
|
||||
if (name !== CACHE_NAME) {
|
||||
return caches.delete(name);
|
||||
}
|
||||
return undefined;
|
||||
}),
|
||||
);
|
||||
await clients.claim();
|
||||
})(),
|
||||
);
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const names = await caches.keys();
|
||||
await Promise.all(
|
||||
names.map((name) => {
|
||||
if (name !== CACHE_NAME) {
|
||||
return caches.delete(name);
|
||||
}
|
||||
return undefined;
|
||||
}),
|
||||
);
|
||||
await clients.claim();
|
||||
})(),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user