Skip to content
Seth Yuan edited this page Nov 21, 2013 · 8 revisions

Given:

var flow = require("asyncflow");

flow(f)

Create and run a flow block. Write your synchronous and wrapped function calls in f. See Basic Usage for more information.

flow.wrap(o, [n])

Wrap an asynchronous function so it can be used within a flow block. o can be a function, or an object (module). When o is a function, the optional second argument n will indicate how many calling arguments are to be passed to the function being wrapped. The default value of n is +Infinity, meaning all calling arguments are to be passed to the function. See Basic Usage and Parallel forEach and map for more information.

flow.forEach(array, [limit], f, cb)

An asynchronous parallel forEach implementation intended to be used outside of a flow block. You can provide an optional concurrency limit to obey, default is unlimited. f is a wrapped asynchronous function. When all array members are done, cb gets called. It has a signature like this: cb(err).

flow.map(array, [limit], f, cb)

An asynchronous parallel map implementation intended to be used outside of a flow block. You can provide an optional concurrency limit to obey, default is unlimited. f is a wrapped asynchronous function. When all array members are done, cb gets called. It has a signature like this: cb(err, mappedArray).

flow.wrapped.forEach

This is the wrapped up version of flow.forEach, obviously to be used within a flow block.

flow.wrapped.map

This is the wrapped up version of flow.map, obviously to be used within a flow block.

flow.extension.wrap

A facility function for easy prototype extension. See Tutorial for more infomartion on how to use it.

flow.extension.collection(method)

A facility function for easy prototype extension. method is one of the collection method's name, like "forEach" or "map". This version is for flow.wrapped collection methods, for flow collection methods, use flow.extension.collectionAsync. See Tutorial for more infomartion on how to use it.

flow.extension.collectionAsync(method)

A facility function for easy prototype extension. method is one of the collection method's name, like "forEach" or "map". This version is for flow collection methods, for flow.wrapped collection methods, use flow.extension.collection. See Tutorial for more infomartion on how to use it.