@@ -9,21 +9,18 @@ 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 flush ( sync ?) {
26
- let { before, after } = this . options ;
27
24
let target ;
28
25
let method ;
29
26
let args ;
@@ -35,14 +32,10 @@ export default class Queue {
35
32
this . _queue = [ ] ;
36
33
}
37
34
38
- if ( before !== undefined ) {
39
- before ( ) ;
40
- }
41
-
42
35
let invoke ;
43
36
let queueItems = this . _queueBeingFlushed ;
44
37
if ( queueItems . length > 0 ) {
45
- let onError = getOnError ( this . globalOptions ) ;
38
+ let onError = getOnError ( this . options ) ;
46
39
invoke = onError ? this . invokeWithOnError : this . invoke ;
47
40
48
41
for ( let i = this . index ; i < queueItems . length ; i += 4 ) {
@@ -73,16 +66,12 @@ export default class Queue {
73
66
}
74
67
75
68
if ( this . index !== this . _queueBeingFlushed . length &&
76
- this . globalOptions . mustYield && this . globalOptions . mustYield ( ) ) {
69
+ this . options . mustYield && this . options . mustYield ( ) ) {
77
70
return QUEUE_STATE . Pause ;
78
71
}
79
72
}
80
73
}
81
74
82
- if ( after !== undefined ) {
83
- after ( ) ;
84
- }
85
-
86
75
this . _queueBeingFlushed . length = 0 ;
87
76
this . index = 0 ;
88
77
if ( sync !== false && this . _queue . length > 0 ) {
0 commit comments