It consists of 8 concise videos with a total length of 18 minutes. Grab a beverage of your choice, lean back, and learn all about ES2017's asynchronous functions:
- Write an Asynchronous Function with
await: This lesson introduces the ES2017
awaitkeywords. It shows how to write a short asynchronous function that makes an HTTP request and parses the response.
- Call an Asynchronous Function in a Promise Chain: In this lesson, we’re exploring how asynchronous functions can be seamlessly called within a promise chain — just like any other function that returns a promise.
- Convert Any Function into an Asynchronous Function: Any function can be made asynchronous, including function expressions, arrow functions, and methods. This lesson shows the syntax for each of the function types.
- Handle Errors in Asynchronous Functions: This lesson shows how regular control flow statements such as
catchblocks can be used to properly handle errors in asynchronous functions. Oftentimes, the resulting code is easier to read than complex promise chains with
- Await Multiple Promises Sequentially or Concurrently: You can await multiple promises either sequentially or concurrently, depending on where you put the
awaitoperators. This lesson shows both approaches and compares the performance characteristics.
- Await Multiple Promises Concurrently with
Promise.all(): Oftentimes, you want to kick off multiple promises in parallel rather than awaiting them in sequence. This lesson explains how that can be achieved in a readable manner using
Promise.all()method, and destructuring assignment.
- Use the
awaitOperator with Any Thenable: The
awaitoperator is not restricted to ES2015 promises. It can be used to await any thenable — that is, any object with a
.then()method. This lesson illustrates how to await promises that have been created using a promise library.
- Iterate Asynchronously with the
ofLoop: We finish the course by looking at asynchronous iterators, a generic data access protocol for asynchronous data sources. This asynchronous iteration scheme is built on top of a new
ofloop and async generator functions.
This post is part of the egghead.io Video Courses series.