]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/main.browser.ts
Update readme screenshot with new design
[github/Chocobozzz/PeerTube.git] / client / src / main.browser.ts
CommitLineData
df98563e
C
1/* tslint: disable */
2
04de542a
C
3import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
4import { decorateModuleRef } from './app/environment'
5import { hmrModule } from '@angularclass/hmr'
8635a2c7
C
6
7/**
ab32b0fc
C
8 * App Module
9 * our top level module that holds all of our components
10 */
04de542a 11import { AppModule } from './app'
41a2aee3 12
8635a2c7 13/**
ab32b0fc
C
14 * Bootstrap our Angular app with a top level NgModule
15 */
04de542a 16export function main (): Promise<any> {
ab32b0fc
C
17 return platformBrowserDynamic()
18 .bootstrapModule(AppModule)
19 .then(decorateModuleRef)
04de542a
C
20 .then((ngModuleRef: any) => {
21 // `module` global ref for webpackhmr
22 // Don't run this in Prod
23 return hmrModule(ngModuleRef, module)
24 })
25 .catch((err) => console.error(err))
4a6995be
C
26}
27
8635a2c7
C
28/**
29 * Needed for hmr
30 * in prod this is replace for document ready
31 */
32switch (document.readyState) {
33 case 'loading':
04de542a
C
34 document.addEventListener('DOMContentLoaded', _domReadyHandler, false)
35 break
8635a2c7
C
36 case 'interactive':
37 case 'complete':
38 default:
04de542a 39 main()
8635a2c7
C
40}
41
04de542a
C
42function _domReadyHandler () {
43 document.removeEventListener('DOMContentLoaded', _domReadyHandler, false)
44 main()
8635a2c7 45}