title: RxJS conditional switch throttle
body: <p>I have a tab bar with tabs and one active tab and I want to prevent multiple clicks on a single tab within a .</p>
  <p>I would like to implement the following behavior:</p>
  <p>Original state with each case: Active tab is tab A.</p>
  <ul>
  <li>If I once press on tab A, I want the A tab event.</li>
  <li>If I repeatably press on tab A, I want to have throttled A events.</li>
  <li>If I press tab B, I want to have the B event.</li>
  <li>If I repeatably press tab B, I want to have the first B event and throttle the other B events.</li>
  </ul>
  <p>In other words:</p>
  <ul>
  <li>press tab event -&gt; if same tab -&gt; throttle-&gt; tab event</li>
  <li>press tab event -&gt; if not same tab -&gt; tab event</li>
  </ul>
  <p>How do I implement this behavior with RxJS?</p>
  <pre><code>this.onTabSelect$.pipe( 
      // TODO ?
  ).subscribe(async (tab: Tab) =&gt; {
      // tab event
  });
  </code></pre>
  <p>Thanks!</p>
  <p>Here is my current (finally working) state: <a href="https://codesandbox.io/s/fancy-sky-i4zsv?file=/src/app/app.component.ts" rel="nofollow noreferrer">code example</a></p>