commit 2349d0b20b1799d006e4ee1cace492c56f671b10 parent f21d7a1418bce816d32935c7cf741e84fd3c683f Author: RobinLinus <RobinLinus@users.noreply.github.com> Date: Tue, 19 May 2020 22:52:27 +0200 Update service-worker.js Diffstat:
M | client/service-worker.js | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/client/service-worker.js b/client/service-worker.js @@ -33,3 +33,22 @@ self.addEventListener('fetch', function(event) { ) ); }); + + +self.addEventListener('activate', function(event) { + console.log('Updating Service Worker...') + event.waitUntil( + caches.keys().then(function(cacheNames) { + return Promise.all( + cacheNames.filter(function(cacheName) { + // Return true if you want to remove this cache, + // but remember that caches are shared across + // the whole origin + return true + }).map(function(cacheName) { + return caches.delete(cacheName); + }) + ); + }) + ); +});