Skip to content

Function: onMutation()

onMutation(element, options?): Stream<MutationRecord[]>

Defined in: streams/onMutation.ts:14

Creates a stream that emits an array of MutationRecord objects whenever a change is detected on a given DOM element.

Automatically unsubscribes if the element is removed from the DOM.

Parameters

element

Element

The DOM element to observe for mutations.

options?

MutationObserverInit

An optional object specifying which DOM changes to observe.

Returns

Stream<MutationRecord[]>

A Stream emitting arrays of MutationRecords.

Released under the MIT License.