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