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}),
|
}, {async: true, key: getKey}),
|
||||||
threads = 0;
|
threads = 0;
|
||||||
ret.cancel = function() {
|
ret.cancel = function() {
|
||||||
|
threads -= processing.length;
|
||||||
processing = [];
|
processing = [];
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
ret.clear = function() {
|
ret.clear = function() {
|
||||||
|
threads = 0;
|
||||||
queued = [];
|
queued = [];
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
@ -134,8 +136,8 @@ Ox.queue = function(fn, maxThreads) {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
processing.splice(index, 1);
|
processing.splice(index, 1);
|
||||||
args.slice(-1)[0](result);
|
args.slice(-1)[0](result);
|
||||||
|
threads--;
|
||||||
}
|
}
|
||||||
threads--;
|
|
||||||
callback();
|
callback();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue