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 concatAll() operator

This operator is analogous to the concat() operator, but it concatenates all observables inside an observable. This operator has the following signature:

observable.concatAll(); 

As you can see, it does not receive any parameter as it will concatenate all observable within an observable. This behavior can be seen in the following example:

Rx.Observable.of(   Rx.Observable.just(1),   Rx.Observable.fromPromise(Promise.resolve(2)),   Rx.Observable.of(3,4) ).concatAll() .subscribe((k)=>console.log(k)); 

In this example, we create an Observable using the of() method, containing three observables. The first only emits the value 1, the second only emits the value 2 (using a Promise), and the third emits two values ...

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