Home > widget-integration > CountdownTimerModule > setupCartDrawerListener
CountdownTimerModule.setupCartDrawerListener() method
Listens for cart drawer open/close events to manage the countdown timer lifecycle inside the cart drawer.
On open: finds the [data-countdown-timer-cart-drawer] placeholder, resolves a new controller, and connects it with cart_drawer scope. On close: destroys the active controller and clears the reference.
Signature:
protected setupCartDrawerListener(): void;
Returns:
void
Example
Override to use a custom placeholder selector:
protected setupCartDrawerListener(): void {
window.addEventListener('boost-sd-cart-drawer-opened', () => {
const el = document.querySelector('.my-custom-timer-slot');
if (el instanceof HTMLElement) this.initCartDrawerTimer(el);
});
window.addEventListener('boost-sd-cart-drawer-closed', () => {
this.destroyCartDrawerTimer();
});
}