Class: Countdown

Countdown(opts)

Class representing a countdown.

For full documentation, see the Countdown Snippet Wiki Page

Constructor

new Countdown(opts)

Create a countdown.

Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Default Description
date Date

Javascript Date Object.

frequency Number <optional>
1

Frequency of COUNTDOWN_TIME event.

suffix String <optional>

String to append to event names.

Source:

Methods

getRemainingTime() → {TimeRemaining}

Get the time remaining in the countdown.

Source:
Returns:

Object with days, hours, minutes, and seconds properties.

Type
TimeRemaining

hasCountdownFinished() → {Boolean}

Find out if countdown has completed.

Source:
Returns:

True if countdown has finished, otherwise False.

Type
Boolean

startCountdown(newDateopt)

Start the countdown.

Parameters:
Name Type Attributes Description
newDate Date <optional>

A new Javascript Date Object to use for the countdown.

Source:
Fires:
  • Countdown#event:COUNTDOWN_TIME - when called and at every tick
  • Countdown#event:COUNTDOWN_COMPLETE - when countdown is finished

stopCountdown()

Stop the countdown.

Source:
Fires:
  • Countdown#event:COUNTDOWN_STOPPED - when called

Events

COUNTDOWN_COMPLETE

Event emitted on $b to indicate the countdown is complete.

Source:

COUNTDOWN_STOPPED

Event emitted on $b to indicate the countdown stopped.

Source:

COUNTDOWN_TIME

Event emitted on $b to pass up-to-date time info.

Type:
Source: