Detect New Elements Using CSS Selectors – sentinel.js

Category: Javascript , Recommended | October 9, 2018
Views Total:73 views
Official Page:Go to website
Last Update:October 9, 2018


Detect New Elements Using CSS Selectors – sentinel.js


sentinel.js is a small (2kb minified) JavaScript library which adds a watch for single or multiple CSS selectors with callback and extra animation support.

How to use it:

Install the sentinel.js into your project.

$ npm install --save sentinel-js
var sentinel = require('sentinel-js');

Or directly download and load the sentinel.js script into your document.

<script src="sentinel.js"></script>

The basic usage.

  • cssSelectors: CSS selectors
  • callbackFn: callback function
  • extraAnimation: triggers extra animations
// sentinel.on(cssSelectors, callbackFn[, extraAnimation])
sentinel.on('.myElement', function(el) {
  // add an input box
  var inputEl = document.createElement('input');
}, 'anim1, anim2');

Remove a watch or a callback.[, callbackFn])

Reset all the watches and callbacks.



v0.0.5 (10/09/2018)

  • Added support for Event object constructor to sentinel-load event

You Might Be Interested In:

Leave a Reply