Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Last active November 10, 2017 13:23
Show Gist options
  • Save gskachkov/1c1fef656b0d2e246b1e5701e934a0e3 to your computer and use it in GitHub Desktop.
Save gskachkov/1c1fef656b0d2e246b1e5701e934a0e3 to your computer and use it in GitHub Desktop.
const promise = new Promise(resolve => {
setTimeout(()=>resolve('success'));
});
const startOperation = () => { console.log('start'); };
const finishOperation = () => { console.log('finish'); };
startOperation();
promise
.then(
result => { console.log('success:', result);},
error => { console.log('error:', error);}
)
.finally(finishOperation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment