new CountdownTimer(startTimeopt)
CountdownTimer is a clock counts down from the time of last reset.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startTime |
number |
<optional> |
0 | the start time of the countdown |
- Source:
Extends
- Clock
Methods
add(deltaTimeopt)
Add more time to the clock's 'start' time (t0).
Note: by adding time to t0, you push the current time forward (make it smaller). As a consequence, getTime() may return a negative number.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
deltaTime |
number |
<optional> |
the time to be added to the clock's start time (t0) |
- Source:
getTime() → {number}
Get the time currently left on the countdown.
- Source:
Returns:
the time left on the countdown (in seconds)
- Type
- number
reset(newTimeopt)
Reset the time on the countdown.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newTime |
number |
<optional> |
if newTime is undefined, the countdown time is reset to zero, otherwise we set it to newTime |
- Source: