1 00:00:00,610 --> 00:00:07,180 In this lecture, we are going to explore one more flattening operator called Exhaust Map Siemens before 2 00:00:07,240 --> 00:00:13,420 it'll subscribe to inner observables values emitted by the observable are pushed to the stream. 3 00:00:13,720 --> 00:00:17,410 What sets it apart is that it'll ignore incoming observables. 4 00:00:17,410 --> 00:00:24,340 If an observable is active, let's say we have an interval observable running in the background intervals 5 00:00:24,340 --> 00:00:27,610 don't end until we force the observable to complete. 6 00:00:28,120 --> 00:00:33,830 Therefore, values will continue to be emitted if a new observable is created. 7 00:00:33,910 --> 00:00:37,390 The exhaust map operator will ignore the observable. 8 00:00:37,750 --> 00:00:40,570 A subscription will never be made to the observable. 9 00:00:40,810 --> 00:00:45,490 As long as there is an active subscription, subsequent observables are ignored. 10 00:00:46,180 --> 00:00:49,060 The first observable will continue to push data. 11 00:00:49,360 --> 00:00:55,090 It's not a common operator to use, but it can be useful if you want to wait for a current observable 12 00:00:55,090 --> 00:00:56,860 to complete before moving on. 13 00:00:57,220 --> 00:01:02,620 For example, if you're developing a form, you may want to prevent duplicate submissions during your 14 00:01:02,620 --> 00:01:03,340 request. 15 00:01:03,640 --> 00:01:10,570 You can use the exhaust map operator to avoid multiple requests from occurring while the initial request 16 00:01:10,570 --> 00:01:11,770 is being processed. 17 00:01:12,910 --> 00:01:18,910 Let's try playing with the operator in the important statements and the exhaust map operator. 18 00:01:21,390 --> 00:01:26,430 Next, where you place the icon cap map operator with the exhaust map operator. 19 00:01:28,930 --> 00:01:32,080 The arguments for this operator can remain unchanged. 20 00:01:32,260 --> 00:01:36,580 The flattening operators all have similar arguments in the browser. 21 00:01:36,610 --> 00:01:38,200 Let's turn throttling on. 22 00:01:40,750 --> 00:01:42,820 Lastly, let's click on the button. 23 00:01:43,120 --> 00:01:47,290 If we look under the network panel, the request is being performed. 24 00:01:47,620 --> 00:01:54,280 The Exhaust Map operator successfully subscribes to the observable after the request has been made. 25 00:01:54,460 --> 00:01:57,910 We can click on the button again to initiate more requests. 26 00:01:58,240 --> 00:02:03,370 However, if we double click on the button, a second request is never initiated. 27 00:02:03,760 --> 00:02:10,000 The exhaust map operator has ignored the second request because the first request is ongoing. 28 00:02:10,630 --> 00:02:15,760 You should be careful with this operator if you don't want your observables to be ignored. 29 00:02:15,970 --> 00:02:18,400 You may want to look for a different operator. 30 00:02:18,730 --> 00:02:23,620 This operator can be helpful in preventing users from spamming form submissions. 31 00:02:24,160 --> 00:02:28,120 That wraps it up for the flattening operators in the next lecture. 32 00:02:28,240 --> 00:02:31,000 Let's do a quick recap before moving on.