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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.