1 # After [![Build Status][1]][2]
3 Invoke callback after n calls
5 ## Status: production ready
7 ## Example
9 var after = require("after")
10 , next = after(3, logItWorks)
12 next()
13 next()
14 next() // it works
16 function logItWorks() {
17 console.log("it works!")
18 }
20 ## Example with error handling
22 var after = require("after")
23 , next = after(3, logError)
25 next()
26 next(new Error("oops")) // logs oops
27 next() // does nothing
29 function logError(err) {
30 console.log(err)
31 }
33 ## After < 0.6.0
35 Older versions of after had iterators and flows in them.
37 These have been replaced with seperate modules
39 - [iterators][8]
40 - [composite][9]
42 ## Installation
44 `npm install after`
46 ## Tests
48 `npm test`
50 ## Blog post
52 - [Flow control in node.js][3]
54 ## Examples :
56 - [Determining the end of asynchronous operations][4]
57 - [In javascript what are best practices for executing multiple asynchronous functions][5]
58 - [JavaScript performance long running tasks][6]
59 - [Synchronous database queries with node.js][7]
61 ## Contributors
63 - Raynos
65 ## MIT Licenced
67 [1]: https://secure.travis-ci.org/Raynos/after.png
68 [2]: http://travis-ci.org/Raynos/after
69 [3]: http://raynos.org/blog/2/Flow-control-in-node.js
70 [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307
71 [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031
72 [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419
73 [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091
74 [8]: http://github.com/Raynos/iterators
75 [9]: http://github.com/Raynos/composite