stepup / 1.1.2 last updated 3 years ago created on Oct 1st 2011
Install
npm install --save stepup
Clone
git clone git@github.com:CrabDude/stepup.git
maintainers
versions
8 total
| 1.1.2 | 3 years ago | crabdude |
| 1.1.1 | 3 years ago | crabdude |
| 1.1.0 | 3 years ago | crabdude |
| 1.0.1 | 3 years ago | crabdude |
| 1.0.0 | 3 years ago | crabdude |
| 0.1.0 | 3 years ago | crabdude |
| 0.0.11 | 4 years ago | crabdude |
| 0.0.9 | 5 years ago | crabdude |
readme
stepup
A simple control-flow library for node.js that makes parallel execution, serial execution, and error handling painless.
Install
Basic Usage
For a complete overview of functionality, see the unit tests.
stepup exports a single function:
Which can be used to execute an array of functions or "steps"
The first argument is the context object, $. $ contains functions for generating callbacks. When all generated callbacks have been called, synchronously or asynchronously, the next step will be called.
Note:
- Any number of callbacks may be generated in a given step.
- If no callbacks are generated (e.g., a value is returned), the next step will proceed.
Additionally, there are many types of generator functions
The group generator is convenient for waiting on a set of async calls
Error Handling
The first error is always passed to the callback, with all remaining results, errors, or steps ignored. If you this is undesirable, considering using $.ignore or wrapping a callback
Additionally, stepup uses the trycatch async try/catch library to catch all errors. To disable, call $.config({useAsyncTrycatch: false})
Extras
$.end
Useful for skipping the remaining steps and passing values to the callback
$.data
Is an object useful for storing state across steps
$.run
Is a convenience function for nesting steps
Options
timeout
Use to guarantee a callback is called after a timeout period