Function: createMutationObserver()
ts
function createMutationObserver(
target,
callback,
options?): MutationObserver;Creates a MutationObserver and observes a target element.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | Node | The target element. |
callback | MutationCallback | The observer callback. |
options | MutationObserverInit | The observer options. |
Returns
MutationObserver
The created observer.
Example
ts
const el = document.createElement('div')
document.body.appendChild(el)
const obs = createMutationObserver(el, (mutations) => console.log(mutations))
console.log(obs instanceof MutationObserver)Since
1.0.0