This is very similar to rxjs's timer operator. It will be have like setTimeout or interval depending on the parameters passed. The value of the timer is incremented after every "tick".
Intervals stay aligned to their intended timeline when callback execution is delayed. By default, missed ticks are discarded and the tick count represents callbacks delivered by the timer. Set missedTickBehavior to 'coalesce' to emit once while advancing the count to its logical position on the elapsed interval timeline.
The signal has methods to pause, resume and restart the timer. Additionally, there is a state signal that will return the current state of the timer.
Use the controls to below to manipulate the timer. The right-most button will toggle between interval and timeout modes.
The timer signal can use a selector function to transform the tick count into a different value. In this case, the tick count is converted to a hexadecimal string.