debounced-mutation-observer

1.0.1 • Public • Published

Debounced Mutation Observer

This micro-library observes DOM changes on arbitrary element (including subtrees) with debounce built-in.

Usage

It's pretty much the same as the native MutationObserver.

For example,

import {DebouncedMutationObserver} from "debounced-mutation-observer";

const msToWait = 1000;
const observer = new DebouncedMutationObserver(callback, msToWait);
observer.observe(document.getElementById('target'));
// ...
observer.disconnect();

Demo

Download this repository, run the NPM build script, then open index.html.

/debounced-mutation-observer/

    Package Sidebar

    Install

    npm i debounced-mutation-observer

    Weekly Downloads

    1

    Version

    1.0.1

    License

    blessing

    Unpacked Size

    15.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • rileyvel