Created
November 19, 2013 11:40
-
-
Save BrianGenisio/7544146 to your computer and use it in GitHub Desktop.
Get the number of watchers in your current page. >2000 is considered too high by many. I find this useful for perf tuning.
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
_($('.ng-scope')) | |
.map(function(scopeElement) { return angular.element(scopeElement).scope().$$watchers; }) | |
.flatten(true) | |
.uniq() | |
.filter(function(x) { return !!x; }) | |
.value() | |
.length; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Angular. Using LoDash for the _() function and jQuery for the $() function.