From 97dc1c0e95fd459889cc501d9d1c968accf8de78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 23 Jul 2023 17:41:19 +0200 Subject: [PATCH] Reimplement the install event handler --- pwa/sw.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pwa/sw.js b/pwa/sw.js index 9aa778e..3b1367f 100644 --- a/pwa/sw.js +++ b/pwa/sw.js @@ -14,12 +14,12 @@ function log_message(msg) { } self.addEventListener('install', (e) => { - log_message('Install'); - e.waitUntil((async () => { - const cache = await caches.open(cache_name); + log_message('Installed'); + self.skipWaiting(); + e.waitUntil(caches.open(cache_name).then((cache) => { log_message('Caching all'); - await cache.addAll(cached_files); - })()); + return cache.addAll(cached_files); + })); }); self.addEventListener('fetch', (e) => {