In this lecture, we are going to explore one more flattening operator called Exhaust Map Siemens before
it'll subscribe to inner observables values emitted by the observable are pushed to the stream.
What sets it apart is that it'll ignore incoming observables.
If an observable is active, let's say we have an interval observable running in the background intervals
don't end until we force the observable to complete.
Therefore, values will continue to be emitted if a new observable is created.
The exhaust map operator will ignore the observable.
A subscription will never be made to the observable.
As long as there is an active subscription, subsequent observables are ignored.
The first observable will continue to push data.
It's not a common operator to use, but it can be useful if you want to wait for a current observable
to complete before moving on.
For example, if you're developing a form, you may want to prevent duplicate submissions during your
request.
You can use the exhaust map operator to avoid multiple requests from occurring while the initial request
is being processed.
Let's try playing with the operator in the important statements and the exhaust map operator.
Next, where you place the icon cap map operator with the exhaust map operator.
The arguments for this operator can remain unchanged.
The flattening operators all have similar arguments in the browser.
Let's turn throttling on.
Lastly, let's click on the button.
If we look under the network panel, the request is being performed.
The Exhaust Map operator successfully subscribes to the observable after the request has been made.
We can click on the button again to initiate more requests.
However, if we double click on the button, a second request is never initiated.
The exhaust map operator has ignored the second request because the first request is ongoing.
You should be careful with this operator if you don't want your observables to be ignored.
You may want to look for a different operator.
This operator can be helpful in preventing users from spamming form submissions.
That wraps it up for the flattening operators in the next lecture.
Let's do a quick recap before moving on.