Invoke a callback with the result.
Callbacks are executed in FIFO order after any cleanups for the producing task have run, and before any asynchronous (Promise) callbacks run. You should only use this (and other Future methods) to obtain a result, not to perform cleanups. (That's what .Context.must() and .Context.release() callbacks are for.)
Invoke a callback if the producing task is canceled.
This is shorthand for a .do() callback that checks for a cancellation, so it uses the same relative order and runs in the same group as other .do callbacks.
The callback run on cancellation
Invoke a callback upon result if the result is an error.
This is shorthand for a .do() callback that checks for an error and marks it handled, so it uses the same relative order and runs in the same group as other .do callbacks.
A callback that will receive the error
Invoke a callback upon result if the result is a success/value.
This is shorthand for a .do() callback that checks for a success/value result, so it uses the same relative order and runs in the same group as other .do callbacks.
A callback that will receive the value
Readonly[toAttaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optionalonfinally: (() => void) | nullThe callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
An asynchronously-expected result (usually produced by a Task) that can be awaited, yielded to, or queried.
Futures implement the Promise interface (then, catch, and finally), so they can be passed to Promise-using APIs or awaited by async functions. They also implement Yieldable, so you can await their results using
yield *.In addition to those asynchronous query/callback methods, they also have the reactive query and synchronous callback methods provided by ObservableResult.
Note: Synchronous callbacks are run in FIFO order before any asynchronous callbacks, but after the producing task's cleanup callbacks have run (if applicable).