Static methods

staticset(callback:() ‑> Void, delay:Float):Timer

Creates a timer and immediately starts it

Parameters:

callback

A function to call after the timer was triggered

delay

Amount of seconds to wait

Returns:

Returns the timer instance

Constructor

new(callback:() ‑> Void, delay:Float)

Creates a timer

Parameters:

callback

A function to call after the timer was triggered

delay

Amount of seconds to wait

Variables

@:value(false)started:Bool = false

Methods

@:value({ lock : true })loop(lock:Bool = true):Bool

Loops the timer.

Parameters:

lock

Whether to skip if the timer is already started

Returns:

Returns true if the timer was looped

@:value({ lock : true, count : 1 })repeat(count:Int = 1, lock:Bool = true):Bool

Starts the timer repeatedly.

Parameters:

count

How many times to start the timer. 0 for infinity

lock

Whether to skip if the timer is already started

Returns:

Returns true if the timer was repeated

@:value({ lock : true })start(lock:Bool = true):Bool

Starts the timer

Parameters:

lock

Whether to skip if the timer is already started

Returns:

Returns true if the timer was started

stop():Void

Stops the timer