I've been exploring AsyncTimerSequence
from AsyncAlgorithms and found it to be a simple solution to continuously emit elements from my await function to a listener.
My problem is that the sequence only emits a value after the given interval. I know by looking through the source code that this is by design. I'd however like to emit a value immediately once some function starts listening to the sequence, and then after the specified interval.
I figured I'd have to create my own AsyncSequence
(by modifying the AsyncTimerSequence
) but I'd just like to know if there's a workaround that doesn't involve writing a new sequence creator.
One can
chain
an asynchronous sequence consisting solely ofnow
(viaasync
) with the timer sequence: