flou
Simple construction of complex flows.
Installation
npm install flou --save
Example
var Flow = ; var saveOrderPromise = order: someOrder ; saveOrderPromise;
API
Flow(initialValues)
Creates flow object initialized with named values passed as hash.
having(name1, name2, name3, ...)
Starts flow step building by accepting names of flow variables which must be resolved (in terms of promises) before step can start.
run(fn1, fn2, fn3, ...)
Schedules execution of given functions once preconditions are met (see having
).
Each function should (but not must!) accept one argument which is hash of named flow variables and should (but not must!) return any value.
Each function result will be saved as flow variable named after function or using value provided via returning
(see next section for details). "Named after function" here means equals to function name without leading verb (for example, result of saveOrderRecord
will be named orderRecord
).
returning(name1, name2, name3, ...)
Explicitly specifies names for function execution results.
finish()
Finalizes flow and returns final promise.
License
BSD