Class: Timer

rune.timer.Timer(options)

The Timer class represents a countdown timer. A Timer can call functions at pre-programmed times, for example at the start and end of the countdown. Timer objects are created via instances of the Timers class.

Constructor

new Timer(options)

Creates a new Timer object.
Parameters:
Name Type Description
options Object Timer options.
Source:

Members

(readonly) active :boolean

If the current Timer object is active (true) or not (false).
Type:
  • boolean
Source:

(readonly) complete :boolean

If the Timer object has reached its end.
Type:
  • boolean
Source:

(readonly) disposed :boolean

If the Timer object has been completed and is about to be removed by the handler.
Type:
  • boolean
Source:

(readonly) elapsed :number

Elapsed time (in milliseconds).
Type:
  • number
Source:

paused :boolean

If the Timer object is paused.
Type:
  • boolean
Source:

(readonly) progressTick :number

The progression of current iteration.
Type:
  • number
Source:

(readonly) progressTotal :number

The progression of the total length.
Type:
  • number
Source:

Methods

pause() → {undefined}

Pauses the Timer object. When an object is paused, no time elapses, but the object is still classified as active. A Timer object can also be paused by changing the paused property to true.
Source:
Returns:
Type
undefined

restart() → {undefined}

Resets and restarts the Timer object.
Source:
Returns:
Type
undefined

resume() → {undefined}

Resumes the Timer object. A Timer object can also be resumed by changing the paused property to false.
Source:
Returns:
Type
undefined

start() → {undefined}

Starts the countdown of the Timer object, but only if the object is inactive.
Source:
Returns:
Type
undefined

stop() → {undefined}

Stops and resets the countdown of the Timer object.
Source:
Returns:
Type
undefined