Home > widget-integration > RecommendationWidgetController > destroy
RecommendationWidgetController.destroy() method
Cleans up event listeners and resources when the controller is no longer needed. This method should be called when the widget is removed or the component is destroyed to prevent memory leaks.
Signature:
destroy(): void;
Returns:
void
Remarks
This method removes global event listeners added in the constructor. It should be called in component cleanup lifecycle hooks or when widgets are dynamically removed.
Example
Clean up when removing widget:
// In component cleanup or widget removal
controller.destroy();