node package manager

tiny-dom-notifier

Get notified when a given DOM element is created or removed

tiny-dom-notifier

Get notified when a given DOM elements are created or removed. Works as a standalone script or with Browserify.

browser support

Install

NPM

npm install tiny-dom-notifier --save

Bower

bower install tiny-dom-notifier --save

Usage

Browser

var notifier = window.tinyDomNotifier;
 
notifier('.some-element')
  .added(function (elements) {
    
  })
  .removed(function (elements) {
    
  });

Browserify

var notifier = require('tiny-dom-notifier');
 
notifier('.some-element')
  .added(function (elements) {
    
  })
  .removed(function (elements) {
    
  });

Methods

added(callback)

  • callback - the function to execute when a DOM element is added. The callbacked receives an array of the elements as the only argument

removed(callback)

  • callback - the function to execute when a DOM element is removed. The callbacked receives an array of the elements as the only argument

Run Tests

Requires Phantomjs is installed

npm install
npm test

Build

npm install
npm run build