feat(instrumentation): do not enable by default

test-unit-sauce
Brian Ford 10 years ago
parent f1c54f3f24
commit 1cfef9bd07

@ -1,3 +1,8 @@
if (document.cookie.indexOf('__ngDebug=true') != -1) {
bootstrapHint();
}
function bootstrapHint () {
var html = document.getElementsByTagName('html')[0];
var eventProxyElement = document.createElement('div');
@ -18,3 +23,4 @@ eventProxyElement.addEventListener('batarangDataEvent', function () {
html.setAttribute('ng-hint', '');
html.appendChild(script);
}

@ -21,6 +21,14 @@ function inspectedAppService($rootScope) {
return invokeAngularHintMethod('assign', scopeId, path, value);
};
this.enableInstrumentation = function (setting) {
setting = !!setting;
chrome.devtools.inspectedWindow.eval(
"window.document.cookie = '__ngDebug=" + setting + ";';" +
"window.document.location.reload();"
);
};
/*
* sets window.$scope to the scope of the given id
*/

@ -8,6 +8,16 @@
sidebar"
style="width: 200px;">
<ol class="sidebar-tree" tabindex="0">
<li class="sidebar-tree-item
profile-launcher-view-tree-item">
<img class="icon">
<div class="status"></div>
<div class="titles no-subtitle">
<span class="title ng-binding">Enable <input type="checkbox" ng-model="enabled"></span>
<span class="subtitle"></span>
</div>
</li>
<li ng-repeat="pane in panes"
ng-click="select(pane)"
class="sidebar-tree-item

@ -1,6 +1,6 @@
angular.module('batarang.tabs', []).
directive('batTabs', function ($compile, $templateCache, $http) {
directive('batTabs', function ($compile, $templateCache, $http, inspectedApp) {
return {
restrict: 'E',
transclude: true,
@ -14,6 +14,12 @@ directive('batTabs', function ($compile, $templateCache, $http) {
this.addPane = function(pane) {
panes.push(pane);
};
$scope.$watch('enabled', function (newVal) {
if (newVal === !!newVal) {
inspectedApp.enableInstrumentation(newVal);
}
});
},
link: function (scope, element, attr) {