A data structure to represent the result of an asynchronous computation.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
A data structure to represent the result of an asynchronous computation.
Results are not constructed directly (generally), but rather returned when asking for the eventual value of a task execution.
const { task } = require('folktale/concurrency/task');
const one = task(resolver => resolver.resolve(1));
one.run().future().map(value => {
$ASSERT(value == 1);
});
Constructs a Future holding a successful value.
Constructs a future holding a failure value.
Converts a Promise to a folktale Future.
A deferred is an internal structure for creating Futures. Because deferred is an imperative structure, users should instead construct futures through the Task structure.
An union defining the possible states of a Future.
Models the eventual result of asynchronous computations.
{
of: Future.of,
rejected: Future.rejected,
fromPromise: Future.fromPromise,
_Deferred: require('./_deferred'),
_ExecutionState: require('./_execution-state'),
_Future: Future
}