@@ -9,17 +9,15 @@ export const enum QUEUE_STATE {
9
9
10
10
export default class Queue {
11
11
private name : string ;
12
- private globalOptions : any ;
13
12
private options : any ;
14
13
private _queueBeingFlushed : any [ ] = [ ] ;
15
14
private targetQueues = new Map ( ) ;
16
15
private index = 0 ;
17
16
private _queue : any [ ] = [ ] ;
18
17
19
- constructor ( name : string , options : any = { } , globalOptions : any = { } ) {
18
+ constructor ( name : string , options : any = { } ) {
20
19
this . name = name ;
21
20
this . options = options ;
22
- this . globalOptions = globalOptions ;
23
21
}
24
22
25
23
public stackFor ( index ) {
@@ -34,7 +32,6 @@ export default class Queue {
34
32
}
35
33
36
34
public flush ( sync ?: Boolean ) {
37
- let { before, after } = this . options ;
38
35
let target ;
39
36
let method ;
40
37
let args ;
@@ -46,14 +43,10 @@ export default class Queue {
46
43
this . _queue = [ ] ;
47
44
}
48
45
49
- if ( before !== undefined ) {
50
- before ( ) ;
51
- }
52
-
53
46
let invoke ;
54
47
let queueItems = this . _queueBeingFlushed ;
55
48
if ( queueItems . length > 0 ) {
56
- let onError = getOnError ( this . globalOptions ) ;
49
+ let onError = getOnError ( this . options ) ;
57
50
invoke = onError ? this . invokeWithOnError : this . invoke ;
58
51
59
52
for ( let i = this . index ; i < queueItems . length ; i += 4 ) {
@@ -84,16 +77,12 @@ export default class Queue {
84
77
}
85
78
86
79
if ( this . index !== this . _queueBeingFlushed . length &&
87
- this . globalOptions . mustYield && this . globalOptions . mustYield ( ) ) {
80
+ this . options . mustYield && this . options . mustYield ( ) ) {
88
81
return QUEUE_STATE . Pause ;
89
82
}
90
83
}
91
84
}
92
85
93
- if ( after !== undefined ) {
94
- after ( ) ;
95
- }
96
-
97
86
this . _queueBeingFlushed . length = 0 ;
98
87
this . index = 0 ;
99
88
if ( sync !== false && this . _queue . length > 0 ) {
0 commit comments