A Timer object will invoke a callback function after a specified number of milliseconds.
There are two types of timers: one-shot or repeating. A one-shot Timer will only run once after the Timer expires, while a repeating Timer will invoke the callback function every n milliseconds until stop() is called. If a repeating Timer fails to run before its next execution time, then any missed executions will be skipped.
The number of available timers (default 3) and the minimum time value (default 50 ms) depends on the host system. An error will occur if too many timers are set.
Months of the year collapse
Methods inherited from
, , , ,
Instance Method Details
start(callback, time, repeat) ⇒ Object
Start the Timer.
# File 'Monkeybrains.rb', line 11160 def start(callback, time, repeat) end
stop ⇒ Object
Stops the Timer from running.
This only needs to be called for repeating timers. A Timer can be started again by calling start().
# File 'Monkeybrains.rb', line 11168 def stop() end