]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/main.browser.ts
Update client modules
[github/Chocobozzz/PeerTube.git] / client / src / main.browser.ts
1 import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2 import { decorateModuleRef } from './app/environment';
3
4 /**
5 * App Module
6 * our top level module that holds all of our components
7 */
8 import { AppModule } from './app';
9
10 /**
11 * Bootstrap our Angular app with a top level NgModule
12 */
13 export function main(): Promise<any> {
14 return platformBrowserDynamic()
15 .bootstrapModule(AppModule)
16 .then(decorateModuleRef)
17 .catch((err) => console.error(err));
18 }
19
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 }