2015-09-04 21:44:24 +00:00
|
|
|
library angular2.src.tools.tools;
|
|
|
|
|
|
|
|
|
|
import 'dart:js';
|
2016-04-14 00:05:17 +00:00
|
|
|
import 'package:angular2/src/core/linker/component_factory.dart'
|
2015-10-20 16:38:14 +00:00
|
|
|
show ComponentRef;
|
2015-09-04 21:44:24 +00: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.
|
|
|
|
|
*/
|
2016-04-30 17:52:04 +00:00
|
|
|
void enableDebugTools(ComponentRef<dynamic> ref) {
|
2015-09-16 00:13:48 +00:00
|
|
|
final tools = new AngularTools(ref);
|
2015-09-04 21:44:24 +00:00
|
|
|
context['ng'] = new JsObject.jsify({
|
|
|
|
|
'profiler': {
|
|
|
|
|
'timeChangeDetection': ([config]) {
|
|
|
|
|
tools.profiler.timeChangeDetection(config);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Disables Angular 2 tools.
|
|
|
|
|
*/
|
|
|
|
|
void disableDebugTools() {
|
|
|
|
|
context.deleteProperty('ng');
|
|
|
|
|
}
|