UNPKG

1.13 kBJavaScriptView Raw
1var Config = require('./config');
2var makeAsyncFunc = require('./makeAsyncFunc');
3/**
4 * Creates a suspendable function. Suspendable functions may use the await() function
5 * internally to suspend execution at arbitrary points, pending the results of
6 * internal asynchronous operations.
7 * @param {Function} fn - Contains the body of the suspendable function. Calls to await()
8 * may appear inside this function.
9 * @returns {Function} A function of the form `(...args) --> Promise`. Any arguments
10 * passed to this function are passed through to fn. The returned
11 * promise is resolved when fn returns, or rejected if fn throws.
12 */
13var async = makeAsyncFunc(new Config());
14async.cps = async.mod('returns: none, callback: true, iterable: false');
15async.thunk = async.mod('returns: thunk, callback: false, iterable: false');
16async.result = async.mod('returns: result, callback: false, iterable: false');
17async.iterable = async.mod('returns: promise, callback: false, iterable: true');
18module.exports = async;
19//# sourceMappingURL=index.js.map
\No newline at end of file