invokeThenInterval
fun WindowOrWorkerGlobalScope.invokeThenInterval(delay: Duration, block: () -> Unit): CancellableActionHandle(source)
A version of setInterval where the action is fired immediately then put on a timer.
In practice, this behavior should be identical to setInterval(initialDelay = 0.milliseconds, delay, block)
, but this version expresses a more explicit intent. Also, this version invokes the callback immediately unlike the setInterval(0.milliseconds)
method which invokes the callback on the next event loop at the earliest.
Return
A CancellableActionHandle to the action being invoked. Use CancellableActionHandle.cancel to cancel the action.