Last active
November 7, 2015 09:36
-
-
Save aegiz/b771b5bf5fc387ec3135 to your computer and use it in GitHub Desktop.
Count angular watchers (type this in your console)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function () { var root = angular.element(document.getElementsByTagName('body')[0]); var watchers = []; var f = function (element) { if (element.data().hasOwnProperty('$scope')) { angular.forEach(element.data().$scope.$$watchers, function (watcher) { watchers.push(watcher); }); } angular.forEach(element.children(), function (childElement) { f(angular.element(childElement)); }); }; f(root); alert(watchers.length);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment