Skip to content

Instantly share code, notes, and snippets.

@7fe
Forked from Raynos/Async_After.js
Created July 30, 2011 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7fe/1115658 to your computer and use it in GitHub Desktop.
Save 7fe/1115658 to your computer and use it in GitHub Desktop.
Flow control utility for node.js
var after = function _after(count, f) {
var c = 0, results = [];
return function _callback() {
results.push( arguments.length > 1 ? arguments : arguments[0] );
if (++c === count) {
f.apply(this, results);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment