diff options
Diffstat (limited to 'client/src/main.browser.aot.ts')
-rw-r--r-- | client/src/main.browser.aot.ts | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/client/src/main.browser.aot.ts b/client/src/main.browser.aot.ts index 29ecf7349..718cb3a80 100644 --- a/client/src/main.browser.aot.ts +++ b/client/src/main.browser.aot.ts | |||
@@ -1,13 +1,14 @@ | |||
1 | import { platformBrowser } from '@angular/platform-browser'; | 1 | import { platformBrowser } from '@angular/platform-browser'; |
2 | import { decorateModuleRef } from './app/environment'; | 2 | import { decorateModuleRef } from './app/environment'; |
3 | /* | 3 | |
4 | /** | ||
4 | * App Module | 5 | * App Module |
5 | * our top level module that holds all of our components | 6 | * our top level module that holds all of our components. |
6 | */ | 7 | */ |
7 | import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory'; | 8 | import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory'; |
8 | 9 | ||
9 | /* | 10 | /** |
10 | * Bootstrap our Angular app with a top level NgModule | 11 | * Bootstrap our Angular app with a top level NgModule. |
11 | */ | 12 | */ |
12 | export function main(): Promise<any> { | 13 | export function main(): Promise<any> { |
13 | return platformBrowser() | 14 | return platformBrowser() |
@@ -16,8 +17,17 @@ export function main(): Promise<any> { | |||
16 | .catch((err) => console.error(err)); | 17 | .catch((err) => console.error(err)); |
17 | } | 18 | } |
18 | 19 | ||
19 | export function bootstrapDomReady() { | 20 | switch (document.readyState) { |
20 | document.addEventListener('DOMContentLoaded', main); | 21 | case 'loading': |
22 | document.addEventListener('DOMContentLoaded', _domReadyHandler, false); | ||
23 | break; | ||
24 | case 'interactive': | ||
25 | case 'complete': | ||
26 | default: | ||
27 | main(); | ||
21 | } | 28 | } |
22 | 29 | ||
23 | bootstrapDomReady(); | 30 | function _domReadyHandler() { |
31 | document.removeEventListener('DOMContentLoaded', _domReadyHandler, false); | ||
32 | main(); | ||
33 | } | ||