Timer

utils/timer. Timer

This class represents a single timer. It is faster than manual setTimeout in situations in which the timer is regularly delayed while it is running.

Constructor

new Timer(callback)

Source:
Parameters:
Name Type Description
callback

The callback to be called when the timer expires.

Methods

restart(delta)

Source:

Set a new expiry time for the timer at the given number of milliseconds from now.

Parameters:
Name Type Description
delta

Offset in milliseconds.

start()

Source:

Start the timer with a given offset. Same as restart().

stop()

Source:

Stop the timer.