Stub
A fake handle which can be used as a stub if you need to initialize a handle before a timer is started.
For example, in code like:
var handle = CancellableActionHandle.Stub
handle = window.setInterval(timeToWaitPerAttempt) {
if (someCondition) {
handle.cancel()
}
}
Content copied to clipboard
In the above case, handle
will be correctly set by the time the first interval callback is triggered.
Without this stub, the user would have to declare handle
as nullable, resulting in handle!!
calls in common cases like the above example represents.