Skip to content

Instantly share code, notes, and snippets.

@AmrAbdulrahman
Created January 25, 2016 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmrAbdulrahman/b2dfe716123155c7bae5 to your computer and use it in GitHub Desktop.
Save AmrAbdulrahman/b2dfe716123155c7bae5 to your computer and use it in GitHub Desktop.
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