Skip to content

Instantly share code, notes, and snippets.

@t9toqwerty
Created April 4, 2018 11:26
Show Gist options
  • Save t9toqwerty/14b49d22e56de44ddb9923f7ccdec49f to your computer and use it in GitHub Desktop.
Save t9toqwerty/14b49d22e56de44ddb9923f7ccdec49f to your computer and use it in GitHub Desktop.
//Single Promise Object
new Promise((resolve, reject) => {
// Your Code which you are unsure about execution time duration.
resolve();//OR reject();
})
.then(() => {
//If resolve()
console.log('Do this');
})
.catch(() => {
//If Reject
console.log('Do that');
})
.then(() => {
console.log('Do this whatever happened before');
});
//-------------------------------------------------------------------------------
let promise=new Promise((resolve, reject) => {
// Your Code which you are unsure about execution time duration.
resolve();//OR reject();
});
promise().then(() => {
console.log('Resolved');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment