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';
|
|
|
|
|
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);
|
|
|
|
appRef.isStable.first().subscribe(() => {
|
|
|
|
(navigator as any).serviceWorker.register('/worker-basic.min.js');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|