dom_token_list-functions-class_list_monitor

1.0.0 • Public • Published

classListMonitor

Monitor for changes in the ClassList of an Element

Events

ClassListChanged

You can capture changes to the class list with event.target.detail.oldClassList and compare with the current element values in element.classList. Only bind this Event to the elements that require monitoring.

document.getElementById("element_to_monitor").addEventListener("ClassListChanged", function(event){
   console.log("newClassList", event.target.classList, "oldClassList", event.target.detail.oldClassList);
});

Installation

npm i dom_token_list-functions-class_list_monitor
window.classListMonitor = require('dom_token_list-functions-class_list_monitor');

Destroy

You can stop the monitoring process with

window.classListMonitor.destroy();

Package Sidebar

Install

npm i dom_token_list-functions-class_list_monitor

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.31 kB

Total Files

4

Last publish

Collaborators

  • webciter