Skip to content

Instantly share code, notes, and snippets.

@kaezarrex
Created March 4, 2012 23:23
Show Gist options
  • Select an option

  • Save kaezarrex/1975352 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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