Timing Events tied to @gamestdio/clock.
ClockTimer is a subclass of
Clock, which adds methods to handle timeout and
intervals relying on
setInterval relies on CPU load, functions may
delay an unexpected amount of time to execute. Having it tied to a clock's time
is guaranteed to execute in a precise way.
See a quote from W3C Timers Specification:
This API does not guarantee that timers will fire exactly on schedule. Delays due to CPU load, other tasks, etc, are to be expected.
setInterval(handler, time, ...args)->
setTimeout(handler, time, ...args)->
clear()- clear all intervals and timeouts.
void- Clear timeout/interval
void- Reset elapsed time
Boolean- Is it still active?
void- Pause the execution
void- Continue the execution
Boolean- Is is paused?