I'm building an RxJS slideshow where, if user holds the right arrow key, I want to navigate to the next tile at every 500 ms. I'm using throttleTime
like below:
const forwardNavigation$ = fromEvent(document, 'keydown').pipe(
filter(event => event.keyCode === KEY_CODE.arrowRight),
throttleTime(500)
);
What I would like to do now is to reduce the throttleTime to 100ms after I have navigated to the 5th tile without releasing the arrow key.
Is that possible, how would one go about implementing that?