Represents the execution of a Task, with methods to cancel it, react to its
results, and retrieve its eventual value. TaskExecution objects aren't created
directly by users, but instead returned as a result from Task's run()
method.
b
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Represents the execution of a Task, with methods to cancel it, react to its
results, and retrieve its eventual value. TaskExecution objects aren't created
directly by users, but instead returned as a result from Task's run()
method.
b
The container for instance methods for the TaskExecution structure.
Cancels a task execution. Does nothing if the task has already been resolved.
Adds a functions to be called when the task settles for each possible state it can transition to.
Represents the execution of a Task, with methods to cancel it, react to its
results, and retrieve its eventual value. TaskExecution objects aren't created
directly by users, but instead returned as a result from Task's run()
method.
b
class TaskExecution {
/*~*/
constructor(task, deferred) {
this._task = task;
this._deferred = deferred;
this._links = [];
}
/*~*/
cancel() {
this._deferred.maybeCancel();
this._links.forEach(link => link.cancel());
return this;
}
/*~*/
listen(pattern) {
this._deferred.listen(pattern);
return this;
}
/*~*/
promise() {
return this._deferred.promise();
}
/*~*/
future() {
return this._deferred.future();
}
/*~*/
link(execution) {
this._links.push(execution);
return this;
}
}