Flow-manager for node
Small library to manage async functions and avoid "callback hell"
Another (async|steps|flow|etc) library?
Well... Yes. But this one is dead simple. Simple library - less overhead and less bugs.
Install
npm install flow-manager
How it works
Create "Flow" object and add some steps. "Step" is a simple callback with two arguments: flow object and data object.
var Flows = ; Flows ; ;
Catch errors
var Flows = ; Flows ; ; // Result:// Error {step1: true, step2: false}
Full control
- flow.next(object) - Goes to the next step. If object is provided - next step will receive it as a data
- flow.nextFrom(int, object) - Same as .next just another step will be used, int - step number
- flow.getStep() - receive current step number
- flow.repeat(object) - repeat current step
- flow.execute(object) - start flow, object holds data for first step, if object is not provided - then first step will receive null
Real world example
Real world is much more complex, than examples, take a look: test.js