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
77
77
* [ ng-count-digest-cycles.js] ( ng-count-digest-cycles.js ) - counts number of full digest cycles (from the root scope)
78
78
that run when a scope method executes. Useful because sometimes you can get away with just a local digest
79
79
cycle, 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.
80
82
* [ ng-throw-error.js] ( ng-throw-error.js ) throws an error from the digest cycle; useful for checking
81
83
if your [ exception handler] ( http://glebbahmutov.com/blog/catch-all-errors-in-angular-app/ ) is working.
82
84
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " code-snippets" ,
3
3
"main" : " first-paint.js" ,
4
- "version" : " 0.4.1 " ,
4
+ "version" : " 0.5.0 " ,
5
5
"homepage" : " https://github.com/bahmutov/code-snippets" ,
6
6
"license" : " MIT" ,
7
7
"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 1
1
{
2
2
"name" : " code-snippets" ,
3
3
"description" : " Chrome DevTools code snippets " ,
4
- "version" : " 0.4.1 " ,
4
+ "version" : " 0.5.0 " ,
5
5
"author" : " Gleb Bahmutov <gleb.bahmutov@gmail.com>" ,
6
6
"bugs" : {
7
7
"url" : " https://github.com/bahmutov/code-snippets/issues"
You can’t perform that action at this time.
0 commit comments