CountdownTimer

util CountdownTimer

CountdownTimer is a clock counts down from the time of last reset.

Constructor

new CountdownTimer(startTimeopt)

Source:
Parameters:
Name Type Attributes Default Description
startTime number <optional>
0

the start time of the countdown

Extends

Methods

add(deltaTimeopt)

Source:
Overrides:

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)

getLastResetTime() → {number}

Source:
Overrides:

Get the current offset being applied to the high resolution timebase used by this Clock.

Returns:

the offset (in seconds)

Type
number

getTime() → {number}

Source:
Overrides:

Get the time currently left on the countdown.

Returns:

the time left on the countdown (in seconds)

Type
number

reset(newTimeopt)

Source:
Overrides:

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