Chapter 4. Asynchronous Control Flow Patterns with ES2015 and Beyond

In the previous chapter, we learned how to deal with asynchronous code using callbacks and how they can have a bad impact on our code, generating issues such as callback hell. Callbacks are the building blocks of asynchronous programming in JavaScript and in Node.js, but over the years, other alternatives have emerged. Those alternatives are more sophisticated in order to be able to deal with asynchronous code in ways that are more convenient.

In this chapter, we are going to explore some of the most famous alternatives, promises and generators. We will also explore async await, an innovative syntax that will be available in JavaScript as part of the release of ECMAScript 2017. ...

Get Node.js Design Patterns - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.