Class: AloTimer

AloTimer


new AloTimer(timeout, timeChain)

Creates the timer

Parameters:
Name Type Argument Default Description
timeout number <optional>
0

How many milliseconds to have the timeout for

timeChain Array.<string> <optional>
["days", "hours", "minutes", "seconds"]

Which units to include in toString().
Valid values are "days", "hours", "minutes", "seconds", and "ms". With the default setting the output for 1
hour 53 minutes 11 seconds and 6 milliseconds would be 00:01:53:11.

Author:
Source:

Members


daysLeft

Returns the amount of days remaining

Author:
Source:

diff

Returns the difference between timeStart and now, taking pause time into account

Author:
Source:

hasFinished

Checks whether the timeout has finished

Author:
Source:

hoursLeft

Returns the amount of hours remaining

Author:
Source:

isPaused

Checks if the timer is currently paused

Author:
Source:

minutesLeft

Returns the amount of minutes remaining

Author:
Source:

msLeft

Returns the amount of milliseconds remaining

Author:
Source:

msSincePause

Returns the number of milliseconds that have passed since the timer was paused

Author:
Source:

pauseTime :Date|boolean

When the timer was paused. Will hold false if the timer isn't currently paused.

Type:
  • Date | boolean
Source:

secondsLeft

Returns the amount of seconds remaining

Author:
Source:

timeChain :Array.<string>

Which units to include in toString()

Type:
  • Array.<string>
Source:

timeout :number

How long the timeout is set for

Type:
  • number
Source:

<readonly> timeStart :number

When the timeout started

Type:
  • number
Source:

Methods


addDays(val)

Adds days to the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

addHours(val)

Adds hours to the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

addMinutes(val)

Adds minutes to the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

addMS(val)

Adds milliseconds to the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

addSeconds(val)

Adds seconds to the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

pause()

Pauses the timer

Author:
Source:
Returns:
Type
AloTimer

subDays(val)

Subtracts days from the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

subHours(val)

Subtracts hours from the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

subMinutes(val)

Subtracts minutes from the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

subMS(val)

Subtracts milliseconds from the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

subSeconds(val)

Subtracts seconds from the timer

Parameters:
Name Type Description
val

The amount to add

Author:
Source:
Returns:
Type
AloTimer

toString()

Returns a string representation of the amount of time remaining

Author:
Source:
Returns:
Type
string

unpause()

Unpauses the timer

Author:
Source:
Returns:
Type
AloTimer