Created
September 12, 2010 02:38
-
-
Save quirkey/575782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a function that accepts a callback with the functions response | |
// executes the function waiting for the callback, and setting `content` | |
// to the returned value before preceeding to the next item in the queue. | |
async: function(fun, callback) { | |
return this.then(function(content) { | |
var context = this; | |
this.wait(); | |
fun(function(response) { | |
context.next(response); | |
}); | |
return false; | |
}).then(callback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment