From 5fec6522de552dfdf7eb15ced35a9df770c362e5 Mon Sep 17 00:00:00 2001 From: rstular Date: Wed, 29 Jan 2020 18:17:21 +0100 Subject: Fixed caching --- sw.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'sw.js') diff --git a/sw.js b/sw.js index 156ec6e..901f721 100644 --- a/sw.js +++ b/sw.js @@ -73,22 +73,15 @@ importScripts("/js/lib/localforage.min.js"); self.addEventListener("install", (evt) => { // Add localforage.clear() if storage purge is required - evt.waitUntil(async function () { - localforage.clear(); + evt.waitUntil( + localforage.clear() + ); + + evt.waitUntil( caches.open(static_cache_name).then((cache) => { cache.addAll(assets); - }); - - if (!evt.clientId) return; - const client = await clients.get(event.clientId); - - if (!client) return; - - client.postMessage({ - msg: "install" - }); - - }); + }) + ); }); // Delete old caches -- cgit v1.2.3