The function to call when the target is resized.
Optional
options: {Optional configuration:
element
: Target to observe (window
, document
, or an HTMLElement
). Defaults to window
.delay
: Debounce delay in milliseconds (only applies to window/document). Defaults to 50
.A cleanup function to remove the listener or disconnect the observer.
Registers a resize callback that works for either the
window
,document
, or a specificHTMLElement
.Internally uses
ResizeObserver
for elements, and a debouncedresize
event for the window or document.