30 lines
757 B
TypeScript
Raw Normal View History

import {ComponentRef} from '@angular/core';
import {global} from '../../../src/facade/lang';
import {AngularTools} from './common_tools';
var context = <any>global;
/**
* Enabled Angular 2 debug tools that are accessible via your browser's
* developer console.
*
* Usage:
*
* 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
* 1. Type `ng.` (usually the console will show auto-complete suggestion)
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
* then hit Enter.
*/
2016-04-27 20:37:10 -07:00
export function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T> {
context.ng = new AngularTools(ref);
return ref;
}
/**
* Disables Angular 2 tools.
*/
export function disableDebugTools(): void {
delete context.ng;
}