]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/main.ts
Retrieve user by id instead of username
[github/Chocobozzz/PeerTube.git] / client / src / main.ts
1 import { ApplicationRef, enableProdMode } from '@angular/core'
2 import { enableDebugTools } from '@angular/platform-browser'
3 import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
4 import { AppModule } from './app/app.module'
5 import { environment } from './environments/environment'
6
7 if (environment.production) {
8 enableProdMode()
9 }
10
11 const bootstrap = () => platformBrowserDynamic()
12 .bootstrapModule(AppModule)
13 .then(bootstrapModule => {
14 // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed
15 // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed?
16 // if ('serviceWorker' in navigator && environment.production) {
17 // navigator.serviceWorker.register('/ngsw-worker.js')
18 // .catch(err => console.error('Cannot register service worker.', err))
19 // }
20
21 if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') {
22 navigator.serviceWorker.getRegistrations()
23 .then(registrations => {
24 for (const registration of registrations) {
25 registration.unregister()
26 }
27 })
28 }
29
30 if (!environment.production) {
31 const applicationRef = bootstrapModule.injector.get(ApplicationRef)
32 const componentRef = applicationRef.components[0]
33
34 // allows to run `ng.profiler.timeChangeDetection();`
35 enableDebugTools(componentRef)
36 }
37
38 return bootstrapModule
39 })
40 .catch(err => {
41 console.error(err)
42 return null
43 })
44
45 bootstrap()