@@ -13,17 +13,15 @@ const QUEUE_ITEM_LENGTH = 4;
1313
1414export default class Queue {
1515 private name : string ;
16- private globalOptions : any ;
1716 private options : any ;
1817 private _queueBeingFlushed : any [ ] = [ ] ;
1918 private targetQueues = new Map ( ) ;
2019 private index = 0 ;
2120 private _queue : any [ ] = [ ] ;
2221
23- constructor ( name : string , options : any = { } , globalOptions : any = { } ) {
22+ constructor ( name : string , options : any = { } ) {
2423 this . name = name ;
2524 this . options = options ;
26- this . globalOptions = globalOptions ;
2725 }
2826
2927 public stackFor ( index ) {
@@ -38,7 +36,6 @@ export default class Queue {
3836 }
3937
4038 public flush ( sync ?: Boolean ) {
41- let { before, after } = this . options ;
4239 let target ;
4340 let method ;
4441 let args ;
@@ -50,14 +47,10 @@ export default class Queue {
5047 this . _queue = [ ] ;
5148 }
5249
53- if ( before !== undefined ) {
54- before ( ) ;
55- }
56-
5750 let invoke ;
5851 let queueItems = this . _queueBeingFlushed ;
5952 if ( queueItems . length > 0 ) {
60- let onError = getOnError ( this . globalOptions ) ;
53+ let onError = getOnError ( this . options ) ;
6154 invoke = onError ? this . invokeWithOnError : this . invoke ;
6255
6356 for ( let i = this . index ; i < queueItems . length ; i += QUEUE_ITEM_LENGTH ) {
@@ -88,16 +81,12 @@ export default class Queue {
8881 }
8982
9083 if ( this . index !== this . _queueBeingFlushed . length &&
91- this . globalOptions . mustYield && this . globalOptions . mustYield ( ) ) {
84+ this . options . mustYield && this . options . mustYield ( ) ) {
9285 return QUEUE_STATE . Pause ;
9386 }
9487 }
9588 }
9689
97- if ( after !== undefined ) {
98- after ( ) ;
99- }
100-
10190 this . _queueBeingFlushed . length = 0 ;
10291 this . index = 0 ;
10392 if ( sync !== false && this . _queue . length > 0 ) {
0 commit comments