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 |
- 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 |
- 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 |
- Source: