Async library

We have so far shown callbacks and Promises. We went from the problem with callbacks, namely callback hell, and how Promises solved that. However, there is a library called async, which is an alternative to callbacks and promises. So why would we want to use the async library instead? The async library is meant to operate on collections in an asynchronous context. The library authors themselves say this about it:

Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript

So, if your asynchronous code starts to become unmanageable and you find yourself wanting to operate on asynchronous collections rather than a few calls here and there, this library might be for you. In most scenarios, promises are most likely what you want though.

The async library comes with a lot of nice functionality. The idea of the async library is to make your code look a lot better so you can focus on building things instead of struggling to see what the code is doing.

To use it, simply install it by typing:

npm install async --save
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.243.106