Created
October 3, 2012 05:49
-
-
Save brian428/3825275 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Using a Promise | |
loadCompanies: -> | |
@companyService.loadCompanies().then( | |
success: ( records ) -> | |
# Do something with results | |
failure: ( error ) -> | |
# Do something with the error | |
).always( -> | |
# Do something whether the call succeeded or failed | |
) | |
# Using a Promise for a chain of async calls | |
loadInitialData: -> | |
@companyService.loadInitialData().then( | |
success: ( records ) -> | |
# Do something with results | |
failure: ( error ) -> | |
# Do something with the error | |
).always( -> | |
# Do something whether the call succeeded or failed | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment