|
|
@ -1,9 +1,9 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
angular.module('batarang.inspected-app', []).
|
|
|
|
angular.module('batarang.inspected-app', []).
|
|
|
|
service('inspectedApp', ['$rootScope', inspectedAppService]);
|
|
|
|
service('inspectedApp', ['$rootScope', '$q', inspectedAppService]);
|
|
|
|
|
|
|
|
|
|
|
|
function inspectedAppService($rootScope) {
|
|
|
|
function inspectedAppService($rootScope, $q) {
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: maybe state should live elsewhere
|
|
|
|
// TODO: maybe state should live elsewhere
|
|
|
|
var scopes = this.scopes = {},
|
|
|
|
var scopes = this.scopes = {},
|
|
|
@ -24,11 +24,23 @@ function inspectedAppService($rootScope) {
|
|
|
|
this.enableInstrumentation = function (setting) {
|
|
|
|
this.enableInstrumentation = function (setting) {
|
|
|
|
setting = !!setting;
|
|
|
|
setting = !!setting;
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
"window.document.cookie = '__ngDebug=" + setting + ";';" +
|
|
|
|
"(function () {" +
|
|
|
|
"window.document.location.reload();"
|
|
|
|
"var prev = document.cookie.indexOf('__ngDebug=true') !== -1;" +
|
|
|
|
|
|
|
|
"if (prev !== " + setting + ") {" +
|
|
|
|
|
|
|
|
"window.document.cookie = '__ngDebug=" + setting + ";';" +
|
|
|
|
|
|
|
|
"window.document.location.reload();" +
|
|
|
|
|
|
|
|
"}" +
|
|
|
|
|
|
|
|
"}())"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getInstrumentationStatus = function () {
|
|
|
|
|
|
|
|
return $q(function(resolve, reject) {
|
|
|
|
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
|
|
|
|
"document.cookie.indexOf('__ngDebug=true') !== -1", resolve);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* sets window.$scope to the scope of the given id
|
|
|
|
* sets window.$scope to the scope of the given id
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|