Optional
opt_legacy: booleanturns on legacy mode, which uses the browser method
setTimeout
instead of requestAnimationFrame
; default is false
Optional
opt_sysClock: SystemClocka SystemClock to use for this Clock (optional)
Private
callthe callback function
Private
delta_How late the last callback was.
Private
fired_When last callback happened
Private
firing_Whether the Timer should be executing the callBacks.
Private
legacy_Whether running under a modern or old browser.
Private
period_period between callbacks, in seconds
Private
Optional
timeoutID_the ID used to cancel the callback
Sets the callback function to be executed periodically, and calls stopFiring to stop the Timer and any previously scheduled callback.
the function to be called periodically; can be null
Sets the default time period between callback execution in seconds of system clock time. A setting of zero means to use the default period which is usually 60 frames per second.
the number of seconds between successive callbacks, or zero to use the default period (usually 60 frames per second).
if period is negative
Private
timerGenerated using TypeDoc
Periodically executes a callback function.
Timer uses JavaScript's
requestAnimationFrame
to repeatedly schedule the callback. On older browsers thesetTimeout
function is used, see setLegacy.If the period is left at the default value of zero, then the callback fires at the rate determined by
requestAnimationFrame
, usually 60 frames per second.If the period is set to a slower frame rate than 60 fps then Timer skips firing the callback occasionally to achieve that slower rate of firing.
See BlankSlateApp for example code using a Timer.