ExhaustMap
Last updated
Was this helpful?
Last updated
Was this helpful?
Projects each source value to an Observable which is merged in the output Observable only if the previous projected Observable has completed.
Basically this exhaustMap
operator ignores every new projected Observable if the previous projected Observable has not yet completed. Once that one completes, it will accept and flatten the next projected Observable and repeat this process. This can prevent clicking many times the same button.
Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source Observable, where that function returns a (so-called "inner") Observable. When it projects a source value to an Observable, the output Observable begins emitting the items emitted by that projected Observable. However, exhaustMap
ignores every new projected Observable if the previous projected Observable has not yet completed. Once that one completes, it will accept and flatten the next projected Observable and repeat this process.
Also, the exhaustMap will help us to avoid multi clicking to a button. Check the following example: