Skip to content

Instantly share code, notes, and snippets.

@RobinDaugherty
Created March 20, 2015 13:44
Show Gist options
  • Select an option

  • Save RobinDaugherty/ce3be4b9174d8d8e6b6c to your computer and use it in GitHub Desktop.

Select an option

Save RobinDaugherty/ce3be4b9174d8d8e6b6c to your computer and use it in GitHub Desktop.
Robin messes with promises
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