@unipro/dms-countdown

1.0.2 • Public • Published

DMS Countdown

Example Usage

function updateCountdown(days, hours, minutes, seconds) {
    // This is called every second
}

function removeCountdown() {
    // This is called on Christmas day 2050
}

const countdown = new Countdown({
    to: new Date(2050, 11, 25),
    precedingZero: true,
    unitsToShow: ['days', 'hours', 'minutes', 'seconds'],
    updateCb: updateCountdown,
    endCb: removeCountdown
})

countdown.start()

Settings

Param Type Description
[endCb] function The Callback to execute once the date has passed.
[precedingZero] boolean Whether to zero-pad the time units.
[pulse] number The number of milliseconds for each tick.
to Date The date to countdown to.
[unitsToShow] Array.<string> The day and time units that will be passed to updateCb.
updateCb function The callback to execute updates on each tick.

The available units are weeks, days, hours, minutes, and seconds

Defaults

Param Default
precedingZero false
pulse 1000
unitsToShow ['days', 'hours', 'minutes', 'seconds']

Readme

Keywords

none

Package Sidebar

Install

npm i @unipro/dms-countdown

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

4.19 kB

Total Files

3

Last publish

Collaborators

  • itdeaprtment
  • steve.sutton
  • alex.gill