Created
February 7, 2013 21:12
-
-
Save fredsterss/4734208 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
# backbone fetch + async lib helper method, automatically routes | |
# the callback from success/error to the async required callback | |
async.fetch = (model) -> | |
return (callback) -> | |
model.fetch | |
success: (model, response) -> | |
callback null, model | |
error: (model, xhr) -> | |
# process failure with errorhandler | |
r.app.errorHandler.handle(xhr) | |
callback xhr.responseText, model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment