Timer
classin packageklyn.gui.windows
public class Timer
Timer

Event-loop based GUI timer.

Timer is intended for GUI refreshes and lightweight periodic actions. Its timeout event is emitted by the native window event loop, so callbacks can safely update widgets and request repaints.

Example
timer = Timer(1000)
timer.timeout += lambda(e as ActionEvent): print("tick")
timer.start()
Properties
Modifier and Type Member Description
public property interval
interval as Int
Timer period in milliseconds.
public readonly property isRunning
isRunning as Boolean
Indicates whether the timer is currently active.
Events
Modifier and Type Member Description
public event timeout
timeout as ActionEvent
Event emitted each time the timer interval elapses.
Constructors
Modifier and Type Member Description
public Timer
Timer(interval as Int = 1000)
Creates a timer with an interval expressed in milliseconds.
Methods
Modifier and Type Member Description
public start
start() as Void
Starts the timer using the current interval.
public start
start(interval as Int) as Void
Starts the timer using a new interval.
public stop
stop() as Void
Stops the timer.
public tick
tick() as Void
Emits the timeout event when called by the native event loop.