I have a tab bar with tabs and one active tab and I want to prevent multiple clicks on a single tab within a .
I would like to implement the following behavior:
Original state with each case: Active tab is tab A.
- If I once press on tab A, I want the A tab event.
- If I repeatably press on tab A, I want to have throttled A events.
- If I press tab B, I want to have the B event.
- If I repeatably press tab B, I want to have the first B event and throttle the other B events.
In other words:
- press tab event -> if same tab -> throttle-> tab event
- press tab event -> if not same tab -> tab event
How do I implement this behavior with RxJS?
this.onTabSelect$.pipe(
// TODO ?
).subscribe(async (tab: Tab) => {
// tab event
});
Thanks!
Here is my current (finally working) state: code example