Invoke callback after n calls
var after = require("after")
, next = after(3, logItWorks)
next()
next()
next() // it works
function logItWorks() {
console.log("it works!")
}
var after = require("after")
, next = after(3, logError)
next()
next(new Error("oops")) // logs oops
next() // does nothing
function logError(err) {
console.log(err)
}
Older versions of after had iterators and flows in them.
These have been replaced with seperate modules
npm install after
npm test