Constructs a Task that resolves with a successful value.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Constructs a Task that resolves with a successful value.
The value is computed eagerly. If you need the value to be computed only when the task is ran you'll have to use the task
function.
const { of } = require('folktale/concurrency/task');
const result = await of('hello').run().promise();
$ASSERT(result == 'hello');
of(value) {
return new Task(resolver => resolver.resolve(value));
}