I am running some code on the render event that decides whether or not some buttons related to scrolling are displayed depending on some element properties:
<aura:handler name="render" value="{!this}" action="{!c.onRender}"/>
If a user resizes their browser window, I'd like to run the same code. But I do not see any component-level mechanism (such as an event) related to such resizing.
Is there an established pattern for responding to browser window resizes in Lightning Components?
(There is a ui:resizeObserver in the open source but that hasn't made it into the set of supported components if this Component Reference list is complete).
Best Answer
Instead of using
you can use
and you can check window.addEventListner to detect the resizing. Paste this code in your doInit JS controller method and check if it works.