A convenience method for the folktale/conversions/nodeback-to-task
module.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
forall s, e:
((Any..., (e, s) => Void) => Void)
=> (Any...)
=> Task e s
A convenience method for the folktale/conversions/nodeback-to-task
module.
const Task = require('folktale/concurrency/task');
const fn = (str, str2, cb) => cb(null, str + str2 + 'processed');
const convertedFn = Task.fromNodeback(fn);
const task = convertedFn('test', '-was-');
const value = await task.run().promise();
$ASSERT(value === 'test-was-processed');
fromNodeback(aNodeback) {
return require('folktale/conversions/nodeback-to-task')(aNodeback);
}