]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/main.ts
Revert "refactor(wt-plugin): create getVideoFile fn"
[github/Chocobozzz/PeerTube.git] / client / src / main.ts
CommitLineData
68f6c87a
C
1import { ApplicationRef, enableProdMode } from '@angular/core'
2import { enableDebugTools } from '@angular/platform-browser'
b6827820 3import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
b6827820
C
4import { AppModule } from './app/app.module'
5import { environment } from './environments/environment'
63c4db6d
C
6
7if (environment.production) {
b6827820 8 enableProdMode()
63c4db6d
C
9}
10
77d07d69 11const bootstrap = () => platformBrowserDynamic()
361dcebc 12 .bootstrapModule(AppModule)
78967fca 13 .then(bootstrapModule => {
fed95155 14 // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed
78967fca 15 // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed?
fed95155
C
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
c7ca4c8b 21 if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') {
73e09f27 22 navigator.serviceWorker.getRegistrations()
361dcebc
C
23 .then(registrations => {
24 for (const registration of registrations) {
25 registration.unregister()
26 }
27 })
73e09f27 28 }
78967fca 29
68f6c87a
C
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
78967fca
C
38 return bootstrapModule
39 })
40 .catch(err => {
41 console.error(err)
42 return null
43 })
77d07d69 44
4f926722 45bootstrap()