Timer
Module | ejs.events |
Definition | class Timer |
Inheritance | Timer ![]() |
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
Qualifiers | Property | Type | Description |
---|---|---|---|
public get set | drift | Boolean | The 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 set | period | Number | The timer interval period in milliseconds. |
Timer Methods
Qualifiers | Method |
---|---|
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.