Skip to content

Instantly share code, notes, and snippets.

@BrianGenisio
Created November 19, 2013 11:40
Show Gist options
  • Save BrianGenisio/7544146 to your computer and use it in GitHub Desktop.
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.
_($('.ng-scope'))
.map(function(scopeElement) { return angular.element(scopeElement).scope().$$watchers; })
.flatten(true)
.uniq()
.filter(function(x) { return !!x; })
.value()
.length;
@BrianGenisio
Copy link
Author

For Angular. Using LoDash for the _() function and jQuery for the $() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment