|
|
|
@ -4,7 +4,7 @@ q(id, function (next) {
|
|
|
|
|
// whatever you need to do....
|
|
|
|
|
|
|
|
|
|
// when you're done
|
|
|
|
|
next();
|
|
|
|
|
next(); // guaranteed to be asynchronous :D
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@ -16,9 +16,11 @@ module.exports = function () {
|
|
|
|
|
var map = {};
|
|
|
|
|
|
|
|
|
|
var next = function (id) {
|
|
|
|
|
if (map[id] && map[id].length === 0) { return void delete map[id]; }
|
|
|
|
|
var task = map[id].shift();
|
|
|
|
|
task(fix1(next, id));
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
if (map[id] && map[id].length === 0) { return void delete map[id]; }
|
|
|
|
|
var task = map[id].shift();
|
|
|
|
|
task(fix1(next, id));
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return function (id, task) {
|
|
|
|
|