Skip to content

Instantly share code, notes, and snippets.

@kaezarrex
Created March 4, 2012 23:23
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 kaezarrex/1975352 to your computer and use it in GitHub Desktop.
Save kaezarrex/1975352 to your computer and use it in GitHub Desktop.
A JavaScript function for chaining asynchronous calls.
function first(func) {
this.then = function(callback) {
return first(function(cb) {
func(function(){
callback(cb);
});
});
};
this.last = function(callback) {
func(callback);
};
return this;
}
@tiwijo
Copy link

tiwijo commented Mar 5, 2012

what the hell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment