tiny-dom-notifier
Get notified when a given DOM elements are created or removed. Works as a standalone script or with Browserify.
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) {
});
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