mergeAll

signature: mergeAll(concurrent: number): Observable



Example 1: mergeAll with promises
Example 2: mergeAll with concurrent parameter
  1. import { take, map, delay, mergeAll } from 'rxjs/operators';
  2. const source = interval(500).pipe(take(5));
  3. /*
  4. interval is emitting a value every 0.5s. This value is then being mapped to interval that
  5. is delayed for 1.0s. The mergeAll operator takes an optional argument that determines how
  6. many inner observables to subscribe to at a time. The rest of the observables are stored
  7. const example = source
  8. .pipe(map(val => source.pipe(delay(1000), take(3))), mergeAll(2))
  9. .subscribe(val => console.log(val));
  10. /*
  11. The subscription is completed once the operator emits all values.

Additional Resources