This operator propagates data from the first mapped observable, and it only goes to the next when it finishes discarding all the other observables before finishing.
The flatMapFirst() operator has the following signature:
It receives up to two parameters; the first is mandatory and the second is optional:
- selectorFunction: It is a function that maps a value to an observable sequence
- selectorContext: In this parameter (context) used in the selectorFunction
An example usage of this operator can be seen in the following code:
Rx.Observable .interval(50) .flatMapFirst( (i)=>Rx.Observable.interval(30) .map((k)=>'running for: '+i+' flatMapFirst: '+k) ...