2017-05-11 13:21:27 -07:00
|
|
|
import { enableProdMode, ApplicationRef } from '@angular/core';
|
2017-03-21 08:27:18 -07:00
|
|
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
|
|
|
2017-01-27 00:20:51 -08:00
|
|
|
import { AppModule } from './app/app.module';
|
2017-03-21 08:27:18 -07:00
|
|
|
import { environment } from './environments/environment';
|
2017-01-27 00:20:51 -08:00
|
|
|
|
|
|
|
if (environment.production) {
|
|
|
|
enableProdMode();
|
|
|
|
}
|
|
|
|
|
2017-05-11 13:21:27 -07:00
|
|
|
platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
|
2017-05-12 09:48:28 +03:00
|
|
|
if (environment.production && 'serviceWorker' in (navigator as any)) {
|
2017-05-11 13:21:27 -07:00
|
|
|
const appRef: ApplicationRef = ref.injector.get(ApplicationRef);
|
|
|
|
appRef.isStable.first().subscribe(() => {
|
|
|
|
(navigator as any).serviceWorker.register('/worker-basic.min.js');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|