From dfdd158a75d91208a8444a8bad1663ca3bafe299 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Sun, 13 Dec 2020 04:15:27 +0100 Subject: client: register service worker closes #296 --- client/src/main.ts | 17 +++-------------- client/src/ngsw-config.json | 7 +++---- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'client') diff --git a/client/src/main.ts b/client/src/main.ts index 0fddf3aac..99976a3f7 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -11,20 +11,9 @@ if (environment.production) { const bootstrap = () => platformBrowserDynamic() .bootstrapModule(AppModule) .then(bootstrapModule => { - // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed - // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? - // if ('serviceWorker' in navigator && environment.production) { - // navigator.serviceWorker.register('/ngsw-worker.js') - // .catch(err => console.error('Cannot register service worker.', err)) - // } - - if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') { - navigator.serviceWorker.getRegistrations() - .then(registrations => { - for (const registration of registrations) { - registration.unregister() - } - }) + if ('serviceWorker' in navigator && environment.production) { + navigator.serviceWorker.register('/ngsw-worker.js') + .catch(err => console.error('Cannot register service worker.', err)) } if (!environment.production) { diff --git a/client/src/ngsw-config.json b/client/src/ngsw-config.json index b5d11e59a..d68db79d0 100644 --- a/client/src/ngsw-config.json +++ b/client/src/ngsw-config.json @@ -7,10 +7,9 @@ "resources": { "files": [ "/index.html", - "/client/assets/images/favicon.png", - "/client/*.bundle.css", - "/client/*.bundle.js", - "/client/*.chunk.js", + "/client/assets/images/icons/favicon.png", + "/client/*.css", + "/client/*.js", "/manifest.webmanifest" ] } -- cgit v1.2.3