This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 5
5
Zone . countingZone = {
6
6
7
7
// setTimeout
8
- enqueueTask : function ( ) {
8
+ '+ enqueueTask' : function ( ) {
9
9
this . data . count += 1 ;
10
10
} ,
11
11
12
12
// fires when...
13
13
// - clearTimeout
14
14
// - setTimeout finishes
15
- dequeueTask : function ( ) {
15
+ '- dequeueTask' : function ( ) {
16
16
this . data . count -= 1 ;
17
17
} ,
18
18
19
- afterTask : function ( ) {
19
+ '+ afterTask' : function ( ) {
20
20
if ( this . data . count === 0 && ! this . data . flushed ) {
21
21
this . data . flushed = true ;
22
22
this . run ( this . onFlush ) ;
Original file line number Diff line number Diff line change @@ -28,20 +28,20 @@ <h1>Counting Pending Tasks</h1>
28
28
*/
29
29
var myCountingZone = zone . fork ( Zone . countingZone ) . fork ( {
30
30
'+onZoneCreated' : function ( ) {
31
- Zone . countingZone . start || ( Zone . countingZone . start = Date . now ( ) ) ;
31
+ this . data . start || ( this . data . start = Date . now ( ) ) ;
32
32
this . print ( ) ;
33
33
} ,
34
34
'-afterTask' : function ( delegate ) {
35
35
this . print ( ) ;
36
36
} ,
37
37
'+reset' : function ( delegate ) {
38
- Zone . countingZone . start = 0 ;
38
+ this . data . start = 0 ;
39
39
} ,
40
40
print : function ( ) {
41
41
counter = this . counter ( ) ;
42
42
output . innerHTML = counter ?
43
43
'pending task count: ' + counter :
44
- ' DONE! ' + ( Date . now ( ) - Zone . countingZone . start ) / 1000 + 's' ;
44
+ ' DONE! ' + ( Date . now ( ) - this . data . start ) / 1000 + 's' ;
45
45
}
46
46
} ) ;
47
47
You can’t perform that action at this time.
0 commit comments