Implemented sequential task

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent 2c4db660cf
commit 089a6eaf50
  1. 4
      BuildServer/lib/tasks/conditional.js
  2. 22
      BuildServer/lib/tasks/sequential.js

@ -11,9 +11,7 @@ module.exports = function (params, processor) {
return processor.done(); return processor.done();
} }
processor.processTask(params.task, function () { processor.processTask(params.task, processor.done.bind(processor));
processor.done();
});
} }
}; };
}; };

@ -0,0 +1,22 @@
"use strict";
var async = require("async");
var series = function (tasks, callback) {
console.log("arguments:");
console.log(arguments);
console.log("first task:");
console.log(tasks[0]);
tasks[0]("xxx");
console.log("executed tasks[0]");
async.series(tasks, callback);
}
module.exports = function (params, processor) {
var mapper = Function.bind.bind(processor.processTask, processor);
return {
process: function () {
async.series(params.tasks.map(function (element) { return mapper(element); }), processor.done.bind(processor));
}
};
};
Loading…
Cancel
Save