Skip to main content

CountdownController

Purpose

A controller that displays a countdown clock to a specified date/time.

Actions

ActionPurpose
--

Targets

TargetPurposeDefault
years (Optional)The target to display the number of years left in the countdown-
months (Optional)The target to display the number of months left in the countdown-
days (Optional)The target to display the number of days left in the countdown-
hours (Optional)The target to display the number of hours left in the countdown-
minutes (Optional)The target to display the number of minutes left in the countdown-
seconds (Optional)The target to display the number of seconds left in the countdown-

Classes

ClassPurposeDefault
countingDown (Optional)The class to apply while the countdown is running-
ended (Optional)The class to apply when the countdown has ended-

Values

ValueTypeDescriptionDefault
deadlineDateThe date/time to count down to-
removeUnusedBooleanWhether to remove unused targets. i.e. if there are no years in the countdownfalse
padZerosBooleanWhether to pad the countdown values for hours, minutes, and seconds with zeros i.e. "06" instead of "6"true

Events

EventWhenDispatched onevent.detail
countdown:endedWhen the countdown endsThe controller root element-

Side Effects

The controller will set an interval using setInterval. Cleans up on disconnect and countdown end.

How to Use

The deadline date can be changed at any point, during ticking or after a countdown has expired and the clock will restart with the new value.