Skip to content

Instantly share code, notes, and snippets.

@phusick
Created November 21, 2014 09:09
Show Gist options
  • Save phusick/242ac2ccfc8b101d7d40 to your computer and use it in GitHub Desktop.
Save phusick/242ac2ccfc8b101d7d40 to your computer and use it in GitHub Desktop.
(function() {
var root = angular.element(document.getElementsByTagName('body'));
var watchers = 0;
var f = function(element) {
if (element.data().hasOwnProperty('$scope')) {
watchers += (element.data().$scope.$$watchers || []).length;
}
angular.forEach(element.children(), function(childElement) {
f(angular.element(childElement));
});
};
f(root);
return watchers;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment