durable-functions
Version:
Durable Functions library for Node.js Azure Functions
28 lines • 982 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.WhenAllTask = void 0;
const CompoundTask_1 = require("./CompoundTask");
const _1 = require(".");
class WhenAllTask extends CompoundTask_1.CompoundTask {
constructor(children, action) {
super(children, action);
this.children = children;
this.action = action;
}
trySetValue(child) {
if (child.stateObj === _1.TaskState.Completed) {
if (this.children.every((c) => c.stateObj === _1.TaskState.Completed)) {
const results = this.children.map((c) => c.result);
this.setValue(false, results);
}
}
else {
if (this.firstError === undefined) {
this.firstError = child.result;
this.setValue(true, this.firstError);
}
}
}
}
exports.WhenAllTask = WhenAllTask;
//# sourceMappingURL=WhenAllTask.js.map
;