Harry Terkelsen 70586b668c fix(debug): make debug tools take ComponentRef
The debug tools used to take ApplicationRefs, which are the old return
type of bootstrap. Now bootstrap returns ComponentRef, so the debug
tools should be updated.

Closes #4203
2015-09-16 18:00:28 +00:00

28 lines
773 B
TypeScript

import {global} from 'angular2/src/core/facade/lang';
import {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';
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): void {
context.ng = new AngularTools(ref);
}
/**
* Disables Angular 2 tools.
*/
export function disableDebugTools(): void {
context.ng = undefined;
}