Skip to content

Instantly share code, notes, and snippets.

@keyvan-m-sadeghi
Last active February 19, 2019 07:07
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 keyvan-m-sadeghi/d4a828568e9eb4c1520a264ea3a36d10 to your computer and use it in GitHub Desktop.
Save keyvan-m-sadeghi/d4a828568e9eb4c1520a264ea3a36d10 to your computer and use it in GitHub Desktop.
let p = delay(500);
p.then(() => console.log('1st then!')); // after 0.5 seconds, logs 1st then!
p.then(() => console.log('2nd then!')); // after 0.5 seconds, logs 2nd then!
p.then(() => console.log('3rd then!')); // after 0.5 seconds, logs 3rd then!
p = p.then(() => Nancy.reject());
p.catch(() => console.log('1st catch!')); // after 0.5 seconds, logs 1st catch!
p.catch(() => console.log('2nd catch!')); // after 0.5 seconds, logs 2nd catch!
p.catch(() => console.log('3rd catch!')); // after 0.5 seconds, logs 3rd catch!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment