dyna-ui-dom-observer
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

About

Detect dom changes with debounce protection.

Get all collected mutations in the meantime.

Written in Typescript, runs everywhere.

Usage

    // create your observer for your container
    const myOberver = new DynaDomObserver({
          rootNode: document.querySelector('#my-component'), 
          onChange: (mutations) => console.log('detected mutations', mutations);
    });

    // when you finish, clean it up
    myObserver.dispose();

Config

IDynaDomChangesConfig {
  rootNode?: Element;                               // optional, default is document.body
  detectChanges?: EChangeType[];                    // optional, default is [EChangeType.ATTR_CHANGE, EChangeType.SUB_NODES_CHANCES]
  debounceTime?: number;                            // optional, timeout in ms, triggers or 1st, debounces the rest, triggers each this timeout, default 300
  onChange: (mutations: MutationRecord[]) => void;  // required, triggers on change
}

Reference

Dom observer, this strange guy

/dyna-ui-dom-observer/

    Package Sidebar

    Install

    npm i dyna-ui-dom-observer

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    40.6 kB

    Total Files

    32

    Last publish

    Collaborators

    • dennisat