2016-05-15 13:28:38 +00:00
|
|
|
"use strict";
|
2017-06-09 21:26:23 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
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: () => {
|
2017-01-19 16:26:35 +00:00
|
|
|
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) {
|
2016-05-15 13:28:38 +00:00
|
|
|
promiseArray.push(taskArg.trigger());
|
|
|
|
});
|
2017-01-19 16:26:35 +00:00
|
|
|
Promise.all(promiseArray)
|
2016-05-15 13:28:38 +00:00
|
|
|
.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-05-15 13:28:38 +00:00
|
|
|
}
|
2016-07-31 22:53:27 +00:00
|
|
|
}
|
2016-05-15 13:28:38 +00:00
|
|
|
exports.Taskparallel = Taskparallel;
|
2017-06-17 14:56:33 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2twYXJhbGxlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrcGFyYWxsZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6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