Skip to content

Instantly share code, notes, and snippets.

@Juraci
Last active October 13, 2016 20:07
Show Gist options
  • Select an option

  • Save Juraci/a0e49c1f3ec93bc340fdd9ec5fd059dc to your computer and use it in GitHub Desktop.

Select an option

Save Juraci/a0e49c1f3ec93bc340fdd9ec5fd059dc to your computer and use it in GitHub Desktop.
Points to consider before using async await
// - It will be one more preset as dependency
// - Await doesn't replace promises it works with promises so we will still use promises
// - It's another concept for an already complex project (think about the onboarding)
// - With promise we have error handling out of the box 'catch', with await we need to add try catch everywhere
// This will be in parallel
getFoo().then((message) => {
console.log(message);
});
getBar().then((message) => {
console.log(message);
});
// This will be sequential
let foo = await getFoo();
console.log(foo);
let bar = await getBar();
console.log(bar);
// more here: https://medium.com/@bluepnume/learn-about-promises-before-you-start-using-async-await-eb148164a9c8#.48rp0li3c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment