aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/main.browser.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/main.browser.ts')
-rw-r--r--client/src/main.browser.ts27
1 files changed, 22 insertions, 5 deletions
diff --git a/client/src/main.browser.ts b/client/src/main.browser.ts
index 70bf48537..f627ba7df 100644
--- a/client/src/main.browser.ts
+++ b/client/src/main.browser.ts
@@ -1,20 +1,37 @@
1import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 1import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2import { decorateModuleRef } from './app/environment'; 2import { decorateModuleRef } from './app/environment';
3import { bootloader } from '@angularclass/hmr'; 3
4/* 4/**
5 * App Module 5 * App Module
6 * our top level module that holds all of our components 6 * our top level module that holds all of our components
7 */ 7 */
8import { AppModule } from './app'; 8import { AppModule } from './app';
9 9
10/* 10/**
11 * Bootstrap our Angular app with a top level NgModule 11 * Bootstrap our Angular app with a top level NgModule
12 */ 12 */
13export function main(): Promise<any> { 13export function main(): Promise<any> {
14 return platformBrowserDynamic() 14 return platformBrowserDynamic()
15 .bootstrapModule(AppModule) 15 .bootstrapModule(AppModule)
16 .then(decorateModuleRef) 16 .then(decorateModuleRef)
17 .catch(err => console.error(err)); 17 .catch((err) => console.error(err));
18} 18}
19 19
20bootloader(main); 20/**
21 * Needed for hmr
22 * in prod this is replace for document ready
23 */
24switch (document.readyState) {
25 case 'loading':
26 document.addEventListener('DOMContentLoaded', _domReadyHandler, false);
27 break;
28 case 'interactive':
29 case 'complete':
30 default:
31 main();
32}
33
34function _domReadyHandler() {
35 document.removeEventListener('DOMContentLoaded', _domReadyHandler, false);
36 main();
37}