API / geotoolkit / util / Timer / Timer
This class provides a Timer feature. It uses the browser's native capabilities to implement a Timer mechanism that will notify the given callback at the given rate. Calling code is responsible for stopping the timer to dispose it cleanly.
Constructors
Constructors
• new Timer(interval?, listener?)
| Name | Type | Description |
|---|---|---|
Optional interval | number | interval between ticks in ms. Default is 1000 ms. |
Optional listener | TimerHandler | function to be called for each tick |
Methods
▸ getInterval(): number
Return time interval in ms between ticks
number
time interval
▸ isStarted(): boolean
Return true if timer is started
boolean
if timer is started
▸ setInterval(interval): Timer
Sets interval of the timer in ms. The given interval will not be applied if the Timer is already started. One should stop and restart the timer to make this change effective.
| Name | Type | Description |
|---|---|---|
interval | number | interval |
this
▸ setListener(listener): Timer
Sets listener
| Name | Type | Description |
|---|---|---|
listener | TimerHandler | function to be called for each tick |
this
▸ start(): Timer
Start timer
this
▸ stop(): Timer
Stop timer
this