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. |
Methods
isFinished() → {boolean}
Returns true if the timeout is finished, false otherwise.
isPaused() → {boolean}
Returns true if the timeout is paused, false otherwise.
isRunning() → {boolean}
Returns true if the timeout is running, false otherwise.
isStopped() → {boolean}
Returns true if the timeout is stopped, false otherwise.
pause()
Pauses the timeout if it is running.
resume()
Resumes the timeout if it is paused.
stop()
Stops the timeout if it is not finished. After this, the timeout cannot be resumed.