Timer

Moduleejs.events
Definition class Timer
InheritanceTimer inherit Object

WARNING: This class is prototype and will be changed in the next release Timers manage the execution of functions at some point in the future.

Timers run repeatedly until stopped by calling the stop() method. Timers are scheduled with a granularity of 1 millisecond. However, many systems are not capable of supporting this granularity and make only best efforts to schedule events at the desired time. To use timers, the application must call Dispatcher.serviceEvents.


Properties

QualifiersPropertyTypeDescription
public get setdriftBooleanThe timer drift setting. If drift is false, reschedule the timer so that the time period between callback start times does not drift and is best-efforts equal to the timer reschedule period. The timer subsystem will delay other low priority events or timers, with drift equal to true, if necessary to ensure non-drifting timers are scheduled exactly. Setting drift to true will schedule the timer so that the time between the end of the callback and the start of the next callback invocation is equal to the period.
public get setperiodNumberThe timer interval period in milliseconds.

Timer Methods

QualifiersMethod
public restart(): Void
 Restart a stopped timer.
public stop(): Void
 Stop a timer running.
Timer(period: Number, callback: Function, drift: Boolean = true)
 Constructor for Timer.

Method Detail

public restart(): Void

Restart a stopped timer.

Description
Once running, the callback function will be invoked every.

public stop(): Void

Stop a timer running.

Description
Once stopped a timer can be restarted by calling.

public Timer(period: Number, callback: Function, drift: Boolean = true)

Constructor for Timer.

Description
The timer is will not be called until.
Parameters
callback: Function Function to invoke when the timer is due.
period: Number Time period in milliseconds between invocations of the callback.
drift: Boolean Set the timers drift setting. See. [default: true]