Closed boccob closed 9 years ago
How would flatMapFirst
be different from concatMap
?
With flatMapFirst
value from initial observable will not be mapped to result observable if the previous one is not ended.
Example:
Source: ------1----2----3x
Spawned 1: -------1x
Spawned 2: -------2x
Spawned 3: -------3x
Result: -------------1---------3x
And Spawned 2
will not be created because Spawned 1
is not completed when 2
appeared in Source
.
Actually I had case when I needed to create new request for each click on element. And I didn't want to create new requests while I didn't get response. Simplified example here: http://jsbin.com/noquqa/2/edit?js,console,output
It already exists (undocumented) as exclusive and exclusiveMap.
Thank you! Does it make sense to add documentation and tests for it?
Actually I found that there is another issue about documentation for this methods. So I'm closing this issue.
Does it make sense to add
flatMapFirst
that is analog offlatMap
which adds new observable only if the previous one ended? It already exists in bacon - flatMapFirst And in kefir - flatMapFirst. And there is no obvious way to do the same in RxJS without creating new function and without adding new variables with current state of mapped observable.I already added it to a project on which I work at the moment and I can do a pull request.