fix Ox.queue cancel + clear
This commit is contained in:
parent
215c364182
commit
e1134f2f4c
1 changed files with 3 additions and 1 deletions
|
@ -105,10 +105,12 @@ Ox.queue = function(fn, maxThreads) {
|
|||
}, {async: true, key: getKey}),
|
||||
threads = 0;
|
||||
ret.cancel = function() {
|
||||
threads -= processing.length;
|
||||
processing = [];
|
||||
return ret;
|
||||
};
|
||||
ret.clear = function() {
|
||||
threads = 0;
|
||||
queued = [];
|
||||
return ret;
|
||||
};
|
||||
|
@ -134,8 +136,8 @@ Ox.queue = function(fn, maxThreads) {
|
|||
if (index > -1) {
|
||||
processing.splice(index, 1);
|
||||
args.slice(-1)[0](result);
|
||||
threads--;
|
||||
}
|
||||
threads--;
|
||||
callback();
|
||||
}));
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue