BREAKING CHANGE: - `ComponetRef`, `ComponentFactory`, `ComponentFixture` now all require a type parameter with the component type. Closes #8361
28 lines
759 B
TypeScript
28 lines
759 B
TypeScript
import {global} from 'angular2/src/facade/lang';
|
|
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
|
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.
|
|
*/
|
|
export function enableDebugTools(ref: ComponentRef<any>): void {
|
|
context.ng = new AngularTools(ref);
|
|
}
|
|
|
|
/**
|
|
* Disables Angular 2 tools.
|
|
*/
|
|
export function disableDebugTools(): void {
|
|
delete context.ng;
|
|
}
|