after

after - tiny flow control

npm install after
423 downloads in the last day
2 620 downloads in the last week
12 120 downloads in the last month

After Build Status

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 :

Contributors

  • Raynos

MIT Licenced

npm loves you