Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function uploadFile(data) {
// we can send notification one or more time as following:
defer.notify(percentageUploaded);
// returns promise
}
uploadFile()
.then(function() {
// fine
}, function() {
// error
}, function(percenatage) {
// get updates before resolving or rejecting the promise
console.log('Uploaded ' + percenatage + '% ...');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment