You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8 KiB

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