Skip to content

Instantly share code, notes, and snippets.

@mdelano
Created July 8, 2015 22:36
Show Gist options
  • Save mdelano/85596bbece5f8dc6952e to your computer and use it in GitHub Desktop.
Save mdelano/85596bbece5f8dc6952e to your computer and use it in GitHub Desktop.
MediaSilo Serial Upload
// Existing implementation
else {
getUploadTicket(file).then(uploadFile).then(function(uploadFileResult) {
return createAsset(uploadFileResult.uploadTicket.assetUrl).then(function(r) {
console.log('Created asset', uploadFileResult);
});
}).fail(function(e) {
console.log(e, e.stack);
});
next();
}
// New implementation. By calling next in the finally of the promise result the next file will only be evaluated when the call to mediasilo completes
else {
getUploadTicket(file).then(uploadFile).then(function(uploadFileResult) {
return createAsset(uploadFileResult.uploadTicket.assetUrl).then(function(r) {
console.log('Created asset', uploadFileResult);
});
}).fail(function(e) {
console.log(e, e.stack);
}).finally(function() {
next();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment