functionupdateCountdown(days,hours,minutes,seconds){// This is called every second}functionremoveCountdown(){// This is called on Christmas day 2050}constcountdown=newCountdown({to: newDate(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