Class ComponentSizeObserver
java.lang.Object
com.vaadin.flow.component.internal.ComponentSizeObserver
- All Implemented Interfaces:
Serializable
Per-UI shared ResizeObserver manager that tracks component sizes using a
single browser
ResizeObserver instance.
One instance is created per UI, lazily via get(UI) when the first
component's size is observed. A single browser ResizeObserver is used
to track all observed elements, dispatching a custom
"vaadin-component-resize" event on the UI element with aggregated
size data.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentSizeObserverReturns the ComponentSizeObserver for the given UI, creating it lazily.voidobserve(Element element, ValueSignal<Component.Size> signal) Starts observing the given element and updates the signal with size changes.voidunobserve(ValueSignal<Component.Size> signal) Stops observing the component associated with the given signal.
-
Method Details
-
get
Returns the ComponentSizeObserver for the given UI, creating it lazily.- Parameters:
ui- the UI to get the observer for- Returns:
- the observer instance
-
observe
Starts observing the given element and updates the signal with size changes.- Parameters:
element- the element to observesignal- the signal to update
-
unobserve
Stops observing the component associated with the given signal.- Parameters:
signal- the signal whose component should stop being observed
-