mergeAll

RxJS 5 mergeAll

HTML

<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script>

JavaScript

console.clear();

const interval = Rx.Observable.interval(500).take(5);

/*
  interval is emitting a value every 0.5s.  This value is then being mapped to interval that 
  is delayed for 1.0s.  The mergeAll operator takes an optional argument that determines how 
  many inner observables to subscribe to at a time.  The rest of the observables are stored 
  in a backlog waiting to be subscribe.
*/
const example = interval
	.map(val => interval.delay(1000).take(3))
  .mergeAll(2)
  .subscribe(val => console.log(val));
/*
  The subscription is completed once the operator emits all values.
*/