fix Ox.queue cancel + clear

This commit is contained in:
rolux 2013-11-20 00:55:08 +01:00
parent 215c364182
commit e1134f2f4c

View file

@ -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();
}));
},