Created
October 3, 2012 05:11
-
-
Save brian428/3825140 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
# Ill-advised attempt to make a chain of async call via underlying Store | |
loadInitialData: -> | |
@companyService.loadCompanies( | |
callback: ( companyRecords, operation, success ) -> | |
if( success ) | |
@companyService.loadFeaturedProducts( | |
callback: ( productRecords, operation, success ) -> | |
if( success ) | |
# Do something with both sets of results | |
else | |
# Do something with the error | |
# Do something whether both calls succeeded or failed | |
) | |
else | |
# Do something with the error | |
# Do something whether both calls succeeded or failed | |
) | |
# Service methods using Store | |
loadCompanies: ( config ) -> | |
@companyStore.load( | |
callback: config.callback | |
) | |
loadFeaturedProducts: ( config ) -> | |
@featuredProductStore.load( | |
callback: config.callback | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment