-
-
Save kapusta/8856846 to your computer and use it in GitHub Desktop.
Angular watchers bookmarklet, compiled by make_bookmarklet.pl by @gruber
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()%20{var%20root%20=%20$(document.getElementsByTagName(%27body%27));var%20watchers%20=%20[];var%20f%20=%20function(element)%20{if%20(element.data().hasOwnProperty(%27$scope%27))%20{angular.forEach(element.data().$scope.$$watchers,%20function(watcher)%20{watchers.push(watcher);});}angular.forEach(element.children(),%20function(childElement)%20{f($(childElement));});};f(root);console.log(watchers.length);}()); |
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
(function() { | |
var root = $(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($(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