README
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();