Home > widget-integration > CountdownTimerController > renderTime
CountdownTimerController.renderTime() method
Render the current time into the DOM via Liquid template.
Called once per second by the tick interval. Parses the rendered HTML, replaces the element's children, injects campaign styles, and binds CTA click handlers.
Signature:
protected renderTime(time: TimeRemaining | null): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
time |
TimeRemaining | null |
The remaining time to display, or |
Returns:
Promise<void>
Remarks
This method runs every second — avoid expensive operations in overrides.
Example
Override to add a CSS class when under 60 seconds:
protected async renderTime(time) {
await super.renderTime(time);
if (time && time.totalMs < 60000) {
this.element?.classList.add('boost-sd__countdown-timer--urgent');
}
}