O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the forkJoin() operator

This operator lets you run multiple observables in parallel and propagates the last elements of each one, so this operator is perfect for implementing flow control for promises or callback operations in JavaScript, as we already discussed in this chapter.

This operator has the following signature:

Rx.Observable.forkJoin(observables); 

This is a class() method instead of an instance() method, and it receives an arbitrary number of arguments and the last is optional:

  • observables: An arbitrary number of observable sequences to be executed
It can also accept a last argument to concatenate the items of the produced array, but this is not a common use case as you can easily do it using the map() operator over the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required