File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ digest duration for several selectors and print sorted table starting with the s
7777* [ ng-count-digest-cycles.js] ( ng-count-digest-cycles.js ) - counts number of full digest cycles (from the root scope)
7878that run when a scope method executes. Useful because sometimes you can get away with just a local digest
7979cycle, rather than a full update. See [ Local Angular scopes] ( http://glebbahmutov.com/blog/local-angular-scopes/ ) .
80+ * [ ng-count-digest-cycle-simple.js] ( ng-count-digest-cycle-simple.js ) - keeps counting number of times
81+ the digest cycle runs.
8082* [ ng-throw-error.js] ( ng-throw-error.js ) throws an error from the digest cycle; useful for checking
8183if your [ exception handler] ( http://glebbahmutov.com/blog/catch-all-errors-in-angular-app/ ) is working.
8284
Original file line number Diff line number Diff line change 11{
22 "name" : " code-snippets" ,
33 "main" : " first-paint.js" ,
4- "version" : " 0.4.1 " ,
4+ "version" : " 0.5.0 " ,
55 "homepage" : " https://github.com/bahmutov/code-snippets" ,
66 "license" : " MIT" ,
77 "ignore" : [
Original file line number Diff line number Diff line change 1+ /*
2+ uses console to print a message every time
3+ the digest cycle runs.
4+ */
5+ ( function monitorDigestCycle ( angular ) {
6+ var injector = angular . element ( document . body ) . injector ( ) ;
7+ if ( ! injector ) {
8+ throw new Error ( 'Missing Angular injector on the document body' ) ;
9+ }
10+ var $rootScope = injector . get ( '$rootScope' ) ;
11+ function dummy ( ) {
12+ console . count ( 'digest cycle' ) ;
13+ }
14+ window . stopWatching = $rootScope . $watch ( dummy ) ;
15+ console . log ( 'run window.stopWatching() to stop watching the digest cycle' ) ;
16+ } ( window . angular ) ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " code-snippets" ,
33 "description" : " Chrome DevTools code snippets " ,
4- "version" : " 0.4.1 " ,
4+ "version" : " 0.5.0 " ,
55 "author" : " Gleb Bahmutov <gleb.bahmutov@gmail.com>" ,
66 "bugs" : {
77 "url" : " https://github.com/bahmutov/code-snippets/issues"
You can’t perform that action at this time.
0 commit comments