Skip to content

Commit bcc8c6b

Browse files
committed
feat: add service worker unregistration during app initialization
1 parent e3c7d34 commit bcc8c6b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/app/app.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
ApplicationConfig,
3+
provideAppInitializer,
34
provideBrowserGlobalErrorListeners,
45
provideZonelessChangeDetection
56
} from '@angular/core';
@@ -26,6 +27,15 @@ export const appConfig: ApplicationConfig = {
2627
theme: {
2728
preset: Aura
2829
}
30+
}),
31+
provideAppInitializer(() => {
32+
if ('serviceWorker' in navigator) {
33+
navigator.serviceWorker.getRegistrations().then(function(registrations) {
34+
for(let registration of registrations) {
35+
registration.unregister();
36+
}
37+
});
38+
}
2939
})
3040
],
3141
};

0 commit comments

Comments
 (0)