1.0.2 • Published 3 years ago

@unipro/dms-countdown v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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

ParamTypeDescription
endCbfunctionThe Callback to execute once the date has passed.
precedingZerobooleanWhether to zero-pad the time units.
pulsenumberThe number of milliseconds for each tick.
toDateThe date to countdown to.
unitsToShowArray.<string>The day and time units that will be passed to updateCb.
updateCbfunctionThe callback to execute updates on each tick.

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

Defaults

ParamDefault
precedingZerofalse
pulse1000
unitsToShow'days', 'hours', 'minutes', 'seconds'