Socket
Socket
Sign inDemoInstall

dom-mutation-notifier

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dom-mutation-notifier

Friendly interface for MutationObserver.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

dom-mutation-notifier Build Status Dependency Status

Friendly interface for MutationObserver. Eight events are implemented: (element|attribute|text|comment)(Added|Removed)

The constructor takes the same arguments as the observe method of MutationObserver. If no options are provided, childList will be watched by default.

MutationNotifier will only start observing when a valid event listener is added (with on). It will stop observing if all listeners have been removed (with off).

Usage

var MutationNotifier = require("dom-mutation-notifier")

var notifier = new MutationNotifier(document.querySelector("body"))
var addListener = function(element) {}
var rmListener = function(element) {}
notifier.on("elementAdded", addListener)
// Observing starts
notifier.on("elementRemoved", rmListener)
notifier.off("elementAdded", addListener)
notifier.off("elementRemoved", rmListener)
// Observing ends

License

dom-mutation-notifier is released under the MIT License. Copyright (c) 2017 Braveg1rl

FAQs

Last updated on 18 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc