]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/main.ts
Non latin keyboard layout support player shortcut (#5684)
[github/Chocobozzz/PeerTube.git] / client / src / main.ts
... / ...
CommitLineData
1import { ApplicationRef, enableProdMode } from '@angular/core'
2import { enableDebugTools } from '@angular/platform-browser'
3import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
4import { AppModule } from './app/app.module'
5import { environment } from './environments/environment'
6import { logger } from './root-helpers'
7
8if (environment.production) {
9 enableProdMode()
10}
11
12logger.registerServerSending(environment.apiUrl)
13
14const bootstrap = () => platformBrowserDynamic()
15 .bootstrapModule(AppModule)
16 .then(bootstrapModule => {
17 if (!environment.production) {
18 const applicationRef = bootstrapModule.injector.get(ApplicationRef)
19 const componentRef = applicationRef.components[0]
20
21 // allows to run `ng.profiler.timeChangeDetection();`
22 enableDebugTools(componentRef)
23 }
24
25 return bootstrapModule
26 })
27 .catch(err => {
28 try {
29 logger.error(err)
30 } catch (err2) {
31 console.error('Cannot log error', { err, err2 })
32 }
33
34 // Ensure we display an "incompatible message" on Angular bootstrap error
35 setTimeout(() => {
36 if (document.querySelector('my-app').innerHTML === '') {
37 throw err
38 }
39 }, 1000)
40
41 return null
42 })
43
44bootstrap()