aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/hmr.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-20 14:21:57 +0200
committerChocobozzz <me@florianbigard.com>2018-09-20 14:21:57 +0200
commit89724816ae79e0c4f9fba6f47267711f505ec7af (patch)
tree5ddbccde1e281f0bf3d49d5a5f63be9d66f4b4b0 /client/src/hmr.ts
parentd466dece0a07555b91f01fa35fcc5dcfe79d9e12 (diff)
downloadPeerTube-89724816ae79e0c4f9fba6f47267711f505ec7af.tar.gz
PeerTube-89724816ae79e0c4f9fba6f47267711f505ec7af.tar.zst
PeerTube-89724816ae79e0c4f9fba6f47267711f505ec7af.zip
Improve videos list client performance
Diffstat (limited to 'client/src/hmr.ts')
-rw-r--r--client/src/hmr.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/src/hmr.ts b/client/src/hmr.ts
index 4d707a250..d5306a7a2 100644
--- a/client/src/hmr.ts
+++ b/client/src/hmr.ts
@@ -1,11 +1,19 @@
1import { NgModuleRef, ApplicationRef } from '@angular/core' 1import { NgModuleRef, ApplicationRef } from '@angular/core'
2import { createNewHosts } from '@angularclass/hmr' 2import { createNewHosts } from '@angularclass/hmr'
3import { enableDebugTools } from '@angular/platform-browser'
3 4
4export const hmrBootstrap = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => { 5export const hmrBootstrap = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => {
5 let ngModule: NgModuleRef<any> 6 let ngModule: NgModuleRef<any>
6 module.hot.accept() 7 module.hot.accept()
7 bootstrap() 8 bootstrap()
8 .then(mod => ngModule = mod) 9 .then(mod => {
10 ngModule = mod
11
12 const applicationRef = ngModule.injector.get(ApplicationRef);
13 const componentRef = applicationRef.components[ 0 ]
14 // allows to run `ng.profiler.timeChangeDetection();`
15 enableDebugTools(componentRef)
16 })
9 module.hot.dispose(() => { 17 module.hot.dispose(() => {
10 const appRef: ApplicationRef = ngModule.injector.get(ApplicationRef) 18 const appRef: ApplicationRef = ngModule.injector.get(ApplicationRef)
11 const elements = appRef.components.map(c => c.location.nativeElement) 19 const elements = appRef.components.map(c => c.location.nativeElement)