Add Service Work(e|a)r(round)
uses the promise in returned by .bootstrapModule to register the serviceworker if required. Seems to work reliable, even in unstable environments. Requires production mode to comprehend. (at least ng build --prod)
This commit is contained in:
parent
4349f2eb11
commit
3e4dffd7a4
@ -10,4 +10,9 @@ if (environment.production) {
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
.then(() => {
|
||||
if ('serviceWorker' in navigator && environment.production) {
|
||||
navigator.serviceWorker.register('ngsw-worker.js');
|
||||
}
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
|
Loading…
Reference in New Issue
Block a user