Skip to content

Instantly share code, notes, and snippets.

@andypotanin
Created May 25, 2016 00:12
Show Gist options
  • Select an option

  • Save andypotanin/3cb7e3f9c640eb25980d988903dcdb21 to your computer and use it in GitHub Desktop.

Select an option

Save andypotanin/3cb7e3f9c640eb25980d988903dcdb21 to your computer and use it in GitHub Desktop.
(function () {
var root = jQuery(document.getElementsByTagName('body'));
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(jQuery(childElement));
});
};
f(root);
console.log(watchers.length);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment