taskbuffer/dist/taskbuffer.classes.taskparallel.js

23 lines
2.0 KiB
JavaScript
Raw Normal View History

"use strict";
2016-07-31 22:53:27 +00:00
const plugins = require("./taskbuffer.plugins");
const taskbuffer_classes_task_1 = require("./taskbuffer.classes.task");
class Taskparallel extends taskbuffer_classes_task_1.Task {
constructor(optionsArg) {
2016-08-01 11:17:15 +00:00
let options = plugins.lodash.merge(optionsArg, {
2016-07-31 22:53:27 +00:00
taskFunction: () => {
let done = plugins.Q.defer();
2016-08-01 11:17:15 +00:00
let promiseArray = []; // stores promises of all tasks, since they run in parallel
2016-07-31 22:53:27 +00:00
this.taskArray.forEach(function (taskArg) {
promiseArray.push(taskArg.trigger());
});
plugins.Q.all(promiseArray)
.then(done.resolve);
return done.promise;
}
});
2016-07-31 22:53:27 +00:00
super(options);
2016-08-01 11:17:15 +00:00
this.taskArray = optionsArg.taskArray;
}
2016-07-31 22:53:27 +00:00
}
exports.Taskparallel = Taskparallel;
2016-08-01 11:17:15 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2twYXJhbGxlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrcGFyYWxsZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUN6QixDQUFDLENBRDhDO0FBRS9DLDBDQUFxQiwyQkFFckIsQ0FBQyxDQUYrQztBQUVoRCwyQkFBa0MsOEJBQUk7SUFFbEMsWUFBWSxVQUVYO1FBQ0csSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQzlCLFVBQVUsRUFDVjtZQUNJLFlBQVksRUFBRTtnQkFDVixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUF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