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(). |
- Source:
Members
-
daysLeft
-
Returns the amount of days remaining
- Source:
-
diff
-
Returns the difference between timeStart and now, taking pause time into account
- Source:
-
hasFinished
-
Checks whether the timeout has finished
- Source:
-
hoursLeft
-
Returns the amount of hours remaining
- Source:
-
isPaused
-
Checks if the timer is currently paused
- Source:
-
minutesLeft
-
Returns the amount of minutes remaining
- Source:
-
msLeft
-
Returns the amount of milliseconds remaining
- Source:
-
msSincePause
-
Returns the number of milliseconds that have passed since the timer was paused
- 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
- 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
- Source:
Returns:
- Type
- AloTimer
-
addHours(val)
-
Adds hours to the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
addMinutes(val)
-
Adds minutes to the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
addMS(val)
-
Adds milliseconds to the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
addSeconds(val)
-
Adds seconds to the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
pause()
-
Pauses the timer
- Source:
Returns:
- Type
- AloTimer
-
subDays(val)
-
Subtracts days from the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
subHours(val)
-
Subtracts hours from the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
subMinutes(val)
-
Subtracts minutes from the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
subMS(val)
-
Subtracts milliseconds from the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
subSeconds(val)
-
Subtracts seconds from the timer
Parameters:
Name Type Description val
The amount to add
- Source:
Returns:
- Type
- AloTimer
-
toString()
-
Returns a string representation of the amount of time remaining
- Source:
Returns:
- Type
- string
-
unpause()
-
Unpauses the timer
- Source:
Returns:
- Type
- AloTimer