Timer

Timer

Timer object tracks how long has passed since it was set

Constructor

# new Timer(timeLeftopt)

Create a timer object set time passed in
Parameters:
Name Type Attributes Description
timeLeft Number <optional>
How much time left before the timer elapses in seconds

Methods

# active() → {Boolean}

Returns true if set and has not elapsed
Returns:
Type
Boolean

# elapsed() → {Boolean}

Returns true if set and elapsed
Returns:
Type
Boolean

# get() → {Number}

Get how long since elapsed, returns 0 if not set
Returns:
Type
Number

# getPercent() → {Number}

Get percentage elapsed based on time it was set to, returns 0 if not set
Returns:
Type
Number

# isSet() → {Boolean}

Returns true if set
Returns:
Type
Boolean

# set(timeLeftopt)

Set the timer with seconds passed in
Parameters:
Name Type Attributes Default Description
timeLeft Number <optional>
0 How much time left before the timer is elapsed in seconds

# unset()

Unset the timer