This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55Zone . countingZone = {
66
77 // setTimeout
8- enqueueTask : function ( ) {
8+ '+ enqueueTask' : function ( ) {
99 this . data . count += 1 ;
1010 } ,
1111
1212 // fires when...
1313 // - clearTimeout
1414 // - setTimeout finishes
15- dequeueTask : function ( ) {
15+ '- dequeueTask' : function ( ) {
1616 this . data . count -= 1 ;
1717 } ,
1818
19- afterTask : function ( ) {
19+ '+ afterTask' : function ( ) {
2020 if ( this . data . count === 0 && ! this . data . flushed ) {
2121 this . data . flushed = true ;
2222 this . run ( this . onFlush ) ;
Original file line number Diff line number Diff line change @@ -28,20 +28,20 @@ <h1>Counting Pending Tasks</h1>
2828 */
2929 var myCountingZone = zone . fork ( Zone . countingZone ) . fork ( {
3030 '+onZoneCreated' : function ( ) {
31- Zone . countingZone . start || ( Zone . countingZone . start = Date . now ( ) ) ;
31+ this . data . start || ( this . data . start = Date . now ( ) ) ;
3232 this . print ( ) ;
3333 } ,
3434 '-afterTask' : function ( delegate ) {
3535 this . print ( ) ;
3636 } ,
3737 '+reset' : function ( delegate ) {
38- Zone . countingZone . start = 0 ;
38+ this . data . start = 0 ;
3939 } ,
4040 print : function ( ) {
4141 counter = this . counter ( ) ;
4242 output . innerHTML = counter ?
4343 'pending task count: ' + counter :
44- ' DONE! ' + ( Date . now ( ) - Zone . countingZone . start ) / 1000 + 's' ;
44+ ' DONE! ' + ( Date . now ( ) - this . data . start ) / 1000 + 's' ;
4545 }
4646 } ) ;
4747
You can’t perform that action at this time.
0 commit comments