diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 12:28:22 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 12:28:22 +0200 |
commit | 8635a2c70cc24a4c52558162ac058de95750271f (patch) | |
tree | a9699b7c6696218604e6b273b4f34a6898d4f16b /client/src/main.browser.ts | |
parent | 66dd264f7b15c05006faa00694c88c56794edc54 (diff) | |
download | PeerTube-8635a2c70cc24a4c52558162ac058de95750271f.tar.gz PeerTube-8635a2c70cc24a4c52558162ac058de95750271f.tar.zst PeerTube-8635a2c70cc24a4c52558162ac058de95750271f.zip |
Update client modules
Diffstat (limited to 'client/src/main.browser.ts')
-rw-r--r-- | client/src/main.browser.ts | 27 |
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 @@ | |||
1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; |
2 | import { decorateModuleRef } from './app/environment'; | 2 | import { decorateModuleRef } from './app/environment'; |
3 | import { 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 | */ |
8 | import { AppModule } from './app'; | 8 | import { 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 | */ |
13 | export function main(): Promise<any> { | 13 | export 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 | ||
20 | bootloader(main); | 20 | /** |
21 | * Needed for hmr | ||
22 | * in prod this is replace for document ready | ||
23 | */ | ||
24 | switch (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 | |||
34 | function _domReadyHandler() { | ||
35 | document.removeEventListener('DOMContentLoaded', _domReadyHandler, false); | ||
36 | main(); | ||
37 | } | ||