2015-09-04 14:44:24 -07:00
|
|
|
library angular2.src.tools.tools;
|
|
|
|
|
|
|
|
import 'dart:js';
|
2015-10-02 07:37:23 -07:00
|
|
|
import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef;
|
2015-09-04 14:44:24 -07:00
|
|
|
import 'common_tools.dart' show AngularTools;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-09-15 17:13:48 -07:00
|
|
|
void enableDebugTools(ComponentRef ref) {
|
|
|
|
final tools = new AngularTools(ref);
|
2015-09-04 14:44:24 -07:00
|
|
|
context['ng'] = new JsObject.jsify({
|
|
|
|
'profiler': {
|
|
|
|
'timeChangeDetection': ([config]) {
|
|
|
|
tools.profiler.timeChangeDetection(config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disables Angular 2 tools.
|
|
|
|
*/
|
|
|
|
void disableDebugTools() {
|
|
|
|
context.deleteProperty('ng');
|
|
|
|
}
|