Created
July 8, 2015 22:36
-
-
Save mdelano/85596bbece5f8dc6952e to your computer and use it in GitHub Desktop.
MediaSilo Serial Upload
This file contains 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
// 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