Class: Timers

rune.timer.Timers(scopeopt)

The Timers class represents a handler for Timer objects. All handling of Timer objects must be done via an instance of this class.

Constructor

new Timers(scopeopt)

Creates a new instance of the Timers class.
Parameters:
Name Type Attributes Description
scope Object <optional>
Scope within which the Timer object's callback functions are executed.
Source:

Members

(readonly) length :number

The number of Timer objects that are currently registered with the Timer instance.
Type:
  • number
Source:

(readonly) numActive :number

The number of registered Timer objects that are currently active. Stopped Timer objects are inactive, but paused are still considered active.
Type:
  • number
Source:

paused :boolean

Pauses all Timer objects that are registered with the Timers instance.
Type:
  • boolean
Default Value:
  • false
Source:

Methods

add(timer, autoStartopt) → {rune.timer.Timer}

Adds the specified Timer object to the handler. Note that new Timer objects should be created using the create method.
Parameters:
Name Type Attributes Default Description
timer rune.timer.Timer Timer object to add.
autoStart boolean <optional>
true If the Timer object is to be started automatically.
Source:
Returns:
Type
rune.timer.Timer

clear() → {undefined}

Removes, and deallocates all registered Timer objects.
Source:
Returns:
Type
undefined

create(options, autoStartopt) → {rune.timer.Timer}

Creates and registers a new Timer object according to the specified options object.
Parameters:
Name Type Attributes Default Description
options Object Timer options.
autoStart boolean <optional>
true If the Timer object is to be started automatically.
Source:
Returns:
The new Timer object.
Type
rune.timer.Timer

remove(timer) → {boolean}

Removes the specified Timer object from the handler and activates the deallocation process for that object.
Parameters:
Name Type Description
timer rune.timer.Timer Timer to remove.
Source:
Returns:
Type
boolean

reset() → {undefined}

Deletes Timer objects that have been completed and restarts Timer objects that have not yet been completed.
Source:
Returns:
Type
undefined