Class: Timer

qui.base.Timer(defaultTimeoutopt, onTimeoutopt, repeatopt)

A convenience class that makes it easy to work with timeouts.

Constructor

new Timer(defaultTimeoutopt, onTimeoutopt, repeatopt)

Parameters:
Name Type Attributes Default Description
defaultTimeout Number <optional>
null

a default timeout, in milliseconds

onTimeout function <optional>
null

an optional timeout callback

repeat Boolean <optional>
false

set to true to automatically restart timer on timeout

Source:

Methods

cancel()

Cancel the timer.

Source:

getRemainingTime() → {Number}

Tell the remaining time, in milliseconds.

Source:
Returns:
Type
Number

isCancelled() → {Boolean}

Tell if the timer has been cancelled.

Source:
Returns:
Type
Boolean

isFired() → {Boolean}

Tell if the timer has fired.

Source:
Returns:
Type
Boolean

isRunning() → {Boolean}

Tell if the timer is currently running.

Source:
Returns:
Type
Boolean

restart(timeoutopt)

Start the timer if it's not currently running. Otherwise cancel and start it over.

Parameters:
Name Type Attributes Default Description
timeout Number <optional>
null

a timeout, in milliseconds, that overrides the timer's defaultTimeout

Source:

start(timeoutopt)

Start the timer.

Parameters:
Name Type Attributes Default Description
timeout Number <optional>
null

a timeout, in milliseconds, that overrides the timer's defaultTimeout

Source: