Created
March 20, 2015 13:44
-
-
Save RobinDaugherty/ce3be4b9174d8d8e6b6c to your computer and use it in GitHub Desktop.
Robin messes with promises
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
| return new RSVP.Promise(function(resolve, reject) { | |
| var fileReaders = fileNames.map(function(filename) { | |
| return readFile('dist/'+filename); | |
| }); | |
| RSVP.all(fileReaders).then(function(fileContents) { | |
| fileUploaders = fileContents.map(function(fileContents, fileIdx) { | |
| return this._uploadIfNotAlreadyInUploadList(uploadName, fileNames[fileIdx], fileContents); | |
| }); | |
| RSVP.all(fileUploaders).then(resolve).catch(reject); | |
| }); | |
| }) | |
| .catch(function(reason) { | |
| return this._printErrorMessage(reason); // TODO: format this message | |
| }.bind(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment