Summary

Throughout this chapter, we analyzed some alternative approaches of dealing with asynchronous control flows considering promises, generators, and the upcoming async await syntax.

We learned how to use these approaches to write asynchronous code that is more concise, cleaner and easier to reason about. We discussed some of the most important advantages and drawbacks of these approaches and realized that even if they are very useful they need some time to be mastered. That's why they should not be seen as a complete replacement of callbacks which are still very useful in many scenarios. As a developer, you should now be able to decide which solution best suits the problem you are facing. If you are building a public library that performs ...

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.