Skip to content

Function: onResize()

onResize(element): Stream<{ width: number; height: number; }>

Defined in: streams/onResize.ts:13

Creates a stream that emits the dimensions (width and height) of a given DOM element whenever it is resized.

Automatically unsubscribes and completes if the element is removed from the DOM.

Parameters

element

HTMLElement

The DOM element to observe for size changes.

Returns

Stream<{ width: number; height: number; }>

A Stream emitting objects with width and height properties.

Released under the MIT License.