From 70a6e586bb362753f96cca22df5b6634ce635d51 Mon Sep 17 00:00:00 2001 From: shprink Date: Wed, 20 Feb 2019 18:24:39 +0100 Subject: [PATCH] replace old service-worker file with a new one that unregister all of them --- static/service-worker.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 static/service-worker.js diff --git a/static/service-worker.js b/static/service-worker.js new file mode 100644 index 0000000..62a72ba --- /dev/null +++ b/static/service-worker.js @@ -0,0 +1,21 @@ +"use strict"; + +if ('serviceWorker' in navigator) { + navigator.serviceWorker.getRegistrations().then(function (registrations) { + if (!registrations.length) { + console.log('No serviceWorker registrations found.') + return + } + for (let registration of registrations) { + registration.unregister().then(function (boolean) { + console.log( + (boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' + + (registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') + + (registration.waiting ? ' .waiting.scriptURL = ' + registration.waiting.scriptURL + '\n' : '') + + (registration.active ? ' .active.scriptURL = ' + registration.active.scriptURL + '\n' : '') + + ' .scope: ' + registration.scope + '\n' + ) + }) + } + }); +} \ No newline at end of file