.. | ||
test | ||
.npmignore | ||
.travis.yml | ||
index.js | ||
LICENCE | ||
package.json | ||
README.md |
After
Invoke callback after n calls
Status: production ready
Example
var after = require("after")
, next = after(3, logItWorks)
next()
next()
next() // it works
function logItWorks() {
console.log("it works!")
}
Example with error handling
var after = require("after")
, next = after(3, logError)
next()
next(new Error("oops")) // logs oops
next() // does nothing
function logError(err) {
console.log(err)
}
After < 0.6.0
Older versions of after had iterators and flows in them.
These have been replaced with seperate modules
Installation
npm install after
Tests
npm test
Blog post
Examples :
- Determining the end of asynchronous operations
- In javascript what are best practices for executing multiple asynchronous functions
- JavaScript performance long running tasks
- Synchronous database queries with node.js
Contributors
- Raynos