2
Async + Await
source link: https://syntax.fm/show/028/async-await
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Jan 17th, 2018
Async + Await
👇 Download Show✏️ Edit Show NotesFreshbooks — Sponsor
If you are a small business or freelancer check out Freshbooks.com Cloud Accounting and get 30 days free. Make sure to enter SYNTAX into the "How did you hear about us" section.
Show Notes
02:55
06:00
- Callback Hell
- Bluebird
- What is a promise?
- Promises are an IOU
- Async + Await IS promises
- What is Async + Await?
- How does the code look?
- Returning values from an await
15:20
- Performance Considerations
- MEGA PROMISES
Promise.all()
- Here is an example:
- const [weather, store] = Promise.all(getWeather(), getStores());
19:22
- This stuff is 100% native
- Most new Browser APIs are build on Promises
- Fetch()
- Some examples:
await fetch('https://api.github.com/users/wesbos').then(data => data.json())
await (await fetch('https://api.github.com/users/wesbos')).json()
- Axios
22:48
27:00
- Snackisodes
- Snack Packs
- Hasty Treats?!!!
28:00
- Making callback-based functions promised basked
- es6-promisify
- util.promisify()
30:00
- Error Handling Methods
- View my slides for some code examples.
- Try/Catch
- High Order Function
- Just handle the error when you
callIt().catch(dealWithIt);
- Node's
process.on('unhandledRejection')
event
36:00
- Browser Support
- Babel it!
38:00
SIIIIICK PICKS
SICK TIP
- Chrome's Autoplay is changing
- Details on this
- Visit chrome://media-engagement to see your scores
Shameless Plugs
Tweet us your tasty treats!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK