Home > widget-integration > FilterController > initEventLineners
FilterController.initEventLineners() method
Initializes all event listeners for the filter system. Sets up handlers for user interactions, filter changes, and UI updates.
Registers handlers for: - Filter tree interactions (collapse, apply, reset, clear) - Product interactions (add to cart, quick view, quick add) - Toolbar actions (sort, pagination, view mode, product limit) - Mobile filter UI (show/hide, back navigation) - Desktop filter UI (toggle, sticky behavior) - Bundle interactions (embedded, volume) - Search and state management
Signature:
initEventLineners(): Promise<void>;
Returns:
Promise<void>
Remarks
Event handlers are registered through the filterHelper.on() method and use the EVENT_NAMES enumeration for type-safe event registration. Many handlers are wrapped in createHandler() for error handling and debugging.
Example 1
Extend to add custom event handlers:
window.boostWidgetIntegration.extend('FilterController', (FilterController) => {
return class CustomFilterController extends FilterController {
async initEventLineners() {
await super.initEventLineners();
// Add custom event listener
this.filterHelper.on('CUSTOM_EVENT', (payload) => {
this.handleCustomEvent(payload);
});
}
};
});
Example 2
Override specific event handler:
window.boostWidgetIntegration.extend('FilterController', (FilterController) => {
return class CustomFilterController extends FilterController {
async initEventLineners() {
// Call parent to register all handlers
await super.initEventLineners();
// Override specific handler
this.filterHelper.on('FILTER_CHANGED', async (payload) => {
this.trackFilterChange(payload);
// Custom handling
});
}
};
});