]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/hmr.ts
Translated using Weblate (Arabic)
[github/Chocobozzz/PeerTube.git] / client / src / hmr.ts
index 4d707a250e1244cbc9dc889b390258f2f9528f9c..adfbca7d9a780a60a9dc00abdc80494234ee1775 100644 (file)
@@ -1,11 +1,19 @@
 import { NgModuleRef, ApplicationRef } from '@angular/core'
 import { createNewHosts } from '@angularclass/hmr'
+import { enableDebugTools } from '@angular/platform-browser'
 
 export const hmrBootstrap = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => {
   let ngModule: NgModuleRef<any>
   module.hot.accept()
   bootstrap()
-    .then(mod => ngModule = mod)
+    .then(mod => {
+      ngModule = mod
+
+      const applicationRef = ngModule.injector.get(ApplicationRef)
+      const componentRef = applicationRef.components[ 0 ]
+      // allows to run `ng.profiler.timeChangeDetection();`
+      enableDebugTools(componentRef)
+    })
   module.hot.dispose(() => {
     const appRef: ApplicationRef = ngModule.injector.get(ApplicationRef)
     const elements = appRef.components.map(c => c.location.nativeElement)