File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11// taken from http://ng.malsup.com/#!/counting-watchers
22( function countAngularWatchers ( angular ) {
33 var i , data , scope ,
4- count = 0 ,
5- all = document . all ,
6- len = all . length ,
7- test = { } ;
4+ count = 0 ,
5+ all = document . all ,
6+ len = all . length ,
7+ test = { } ,
8+ watchers = [ ] ;
89
910 var mostWatchers = 0 ;
1011
1112 function countScopeWatchers ( scope , element ) {
1213 test [ scope . $id ] = true ;
1314 var n = scope . $$watchers . length ;
1415 count += n ;
16+ if ( n > 0 ) {
17+ watchers . push . apply ( watchers , scope . $$watchers ) ;
18+ }
1519 if ( n > mostWatchers ) {
1620 console . log ( 'most watchers' , n ) ;
1721 console . log ( element ) ;
1822 mostWatchers = n ;
23+
1924 }
2025 }
2126
3035 }
3136 }
3237 }
33- console . log ( 'this page has' , count , ' angular watchers' ) ;
38+ console . log ( 'this page has ' + watchers . length + ' angular watchers and the watchers are:' , watchers ) ;
3439 return count ;
3540} ( window . angular ) ) ;
You can’t perform that action at this time.
0 commit comments