performance tab enable/disable persists with the cookie setting

test-unit-sauce
Brian Ford 12 years ago
parent bc238f9198
commit c7123216cc

@ -8,7 +8,7 @@ panelApp.filter('sortByTime', function () {
panelApp.controller('PerfCtrl', function PerfCtrl($scope, appContext, filesystem) {
$scope.enable = false;
//$scope.enable = false;
$scope.histogram = [];
$scope.timeline = [];
@ -21,23 +21,25 @@ panelApp.controller('PerfCtrl', function PerfCtrl($scope, appContext, filesystem
filesystem.exportJSON('file.json', $scope.histogram);
};
var first = true;
$scope.$watch('enable', function (newVal, oldVal) {
appContext.getDebug(function (result) {
$scope.enable = result;
// prevent refresh on initial pageload
if (first) {
first = false;
} else {
appContext.setDebug(newVal);
}
if (newVal) {
//updateTimeline();
updateHistogram();
}
$scope.$watch('enable', function (newVal, oldVal) {
// prevent refresh on initial pageload
if (first) {
first = false;
} else {
appContext.setDebug(newVal);
}
if (newVal) {
//updateTimeline();
updateHistogram();
}
});
});
$scope.log = false;
var first = true;
$scope.$watch('log', function (newVal, oldVal) {
appContext.setLog(newVal);

@ -265,6 +265,12 @@ panelApp.factory('appContext', function(chromeExtension) {
}
},
getDebug: function (cb) {
chromeExtension.eval(function (window) {
return document.cookie.indexOf('__ngDebug=true') != -1;
}, cb);
},
// takes a bool
setLog: function (setting) {
chromeExtension.eval('function (window) {' +