`timer` calls a callback repeatedly from a timer thread.
The callback receives one argument: the timer call count. The first callback receives `1`.
Creates a timer object using a callable object.
Arguments:
| Argument | Description |
|---|---|
| `callback` | Function reference, method reference, or other object that implements `call(count)`. |
function OnTimer(count) { print('timer ', count); } t = timer(OnTimer);
Starts the timer and returns `true` on success.
Arguments:
| Argument | Description |
|---|---|
| `intervalMs` | Timer interval in milliseconds. Values less than or equal to zero are treated as `1`. |
t = timer(OnTimer); t.start(1000);
Starts the timer with a repeat count and returns `true` on success.
Arguments:
| Argument | Description |
|---|---|
| `intervalMs` | Timer interval in milliseconds. |
| `count` | Number of callbacks. Values less than or equal to zero mean continuous periodic execution. |
t = timer(OnTimer); t.start(500, 3); // call OnTimer three times
Stops the timer and returns `true` if it was running.
t.stop();
Returns `true` while the timer is running.
if (t.is_running()) { print('timer is active'); }
Returns a short text summary of timer methods.