async.series()

Another scenario is that you might want to actually have the calls happen one after another. For that, we get the async.series() method, which we call like this:

async.series([  function login(){}  function loadUserDetails() {}],(result) => {})

Running the code like this guarantees the order in which it will be run, but also ensures that the chain of calls does not continue if there is an error.

There are a ton of useful functions in this library and we urge you to have a look at the documentation at https://caolan.github.io/async/docs.html.

Get Architecting Angular Applications with Redux, RxJS, and NgRx 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.