X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fhmr.ts;h=adfbca7d9a780a60a9dc00abdc80494234ee1775;hb=852ecadfc4284aa2f8110274ff49d2a53d4166ba;hp=4d707a250e1244cbc9dc889b390258f2f9528f9c;hpb=77d07d690968a9631fc0c8bafbaebd27a5ebaab6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/hmr.ts b/client/src/hmr.ts index 4d707a250..adfbca7d9 100644 --- a/client/src/hmr.ts +++ b/client/src/hmr.ts @@ -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>) => { let ngModule: NgModuleRef 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)