Timeout

utils. Timeout

A class that represents a timeout or interval.

Constructor

new Timeout(duration, callback, repeatopt)

Creates and starts a new timeout.

Parameters:
Name Type Attributes Default Description
duration number

The duration of the timeout in miliseconds.

callback function

The callback to execute when the timeout is completed.

repeat boolean <optional>
false

true if the timeout should repeat like an interval.

Source:

Methods

isFinished() → {boolean}

Returns true if the timeout is finished, false otherwise.

Source:

isPaused() → {boolean}

Returns true if the timeout is paused, false otherwise.

Source:

isRunning() → {boolean}

Returns true if the timeout is running, false otherwise.

Source:

isStopped() → {boolean}

Returns true if the timeout is stopped, false otherwise.

Source:

pause()

Pauses the timeout if it is running.

Source:

resume()

Resumes the timeout if it is paused.

Source:

stop()

Stops the timeout if it is not finished. After this, the timeout cannot be resumed.

Source: