Class ResizeObserverManager
Index
Constructors
Methods
Constructors
constructor
- new
Resize (): ResizeObserverManagerObserver Manager Returns ResizeObserverManager
Methods
add
- add(el, target): void
Add an HTMLElement and ResizeObserverData.ResizeTarget instance for monitoring. Create cached style attributes for the given element include border & padding dimensions for offset width / height calculations.
Parameters
- el: HTMLElement
The element to observe.
- target: ResizeTarget
A target that contains one of several mechanisms for updating resize data.
Returns void
- el: HTMLElement
clear
remove
- remove(el, target?): void
Removes all ResizeObserverData.ResizeTarget instances for the given element from monitoring when just an element is provided otherwise removes a specific target from the monitoring map. If no more targets remain then the element is removed from monitoring.
Parameters
- el: HTMLElement
Element to remove from monitoring.
Optional
target: ResizeTargetA specific target to remove from monitoring.
Returns void
- el: HTMLElement
updateCache
- update
Cache (el): void Provides a function that when invoked with an element updates the cached styles for each subscriber of the element.
The style attributes cached to calculate offset height / width include border & padding dimensions. You only need to update the cache if you change border or padding attributes of the element.
Parameters
- el: HTMLElement
A HTML element.
Returns void
- el: HTMLElement
Provides an instance of ResizeObserver that can manage multiple elements and notify a wide range of ResizeObserverData.ResizeTarget listeners. Offset width and height is also provided through caching the margin and padding styles of the target element.
The action, resizeObserver, utilizes ResizeObserverManager for automatic registration and removal via Svelte.