Is there a way in an rxjs observable chain to perform a task with access to the current value of the observable after a specific time interval has elapsed? I'm essentially looking for a functionality akin to the tap operator, but one that triggers only if a certain amount of time passes without any new values emitted by the observable. In essence, it's like a combination of tap and timeout.
Here's a hypothetical scenario:
observable$.pipe(
first(x => x > 5),
tapAfterTime(2000, x => console.log(x)),
map(x => x + 1)
).subscribe(...);
This example is fabricated, and the "tapAfterTime" function doesn't actually exist. However, the concept revolves around the idea that if 2000ms go by after subscribing to the observable without encountering a value greater than 5, then execute the tapAfterTime callback function on the current value of the observable. If a value greater than 5 is received before the 2000ms mark, the tapAfterTime callback won't trigger, but the map function will proceed as planned.
Does anyone know of an operator or combination of operators that could achieve this behavior?