2017-05-11 16:21:27 -04:00
|
|
|
import { enableProdMode, ApplicationRef } from '@angular/core';
|
2017-03-21 11:27:18 -04:00
|
|
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
2018-03-20 21:40:23 -04:00
|
|
|
import { first } from 'rxjs/operators';
|
2017-03-21 11:27:18 -04:00
|
|
|
|
2017-01-27 03:20:51 -05:00
|
|
|
import { AppModule } from './app/app.module';
|
2017-03-21 11:27:18 -04:00
|
|
|
import { environment } from './environments/environment';
|
2017-01-27 03:20:51 -05:00
|
|
|
|
|
|
|
if (environment.production) {
|
|
|
|
enableProdMode();
|
|
|
|
}
|
|
|
|
|
2017-05-11 16:21:27 -04:00
|
|
|
platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
|
2017-05-12 02:48:28 -04:00
|
|
|
if (environment.production && 'serviceWorker' in (navigator as any)) {
|
2017-05-11 16:21:27 -04:00
|
|
|
const appRef: ApplicationRef = ref.injector.get(ApplicationRef);
|
2018-02-22 18:44:35 -05:00
|
|
|
appRef.isStable.pipe(first(v => v)).subscribe(() => {
|
2017-05-11 16:21:27 -04:00
|
|
|
(navigator as any).serviceWorker.register('/worker-basic.min.js');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|