fromNodeback

A convenience method for the folktale/conversions/nodeback-to-task module.

This feature is experimental!

This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.

Signature

fromNodeback(aNodeback)
forall s, e:
  ((Any..., (e, s) => Void) => Void)
  => (Any...)
  => Task e s

Documentation

A convenience method for the folktale/conversions/nodeback-to-task module.

Example:

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');

Properties

Source Code

Defined in source/concurrency/task/index.js at line 17, column 17
fromNodeback(aNodeback) {
    return require('folktale/conversions/nodeback-to-task')(aNodeback);
  }
Stability
experimental
Licence
MIT
Module
folktale/concurrency/task
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)