Skip to content

Instantly share code, notes, and snippets.

@littlepsylo
Forked from PaulKinlan/monitorEvents.js
Created October 22, 2016 16:20
Show Gist options
  • Save littlepsylo/00f69c14be3d68f123383bae722c1703 to your computer and use it in GitHub Desktop.
Save littlepsylo/00f69c14be3d68f123383bae722c1703 to your computer and use it in GitHub Desktop.
monitorEvents.js
function monitorEvents(element) {
var log = function(e) { console.log(e);};
var events = [];
for(var i in element) {
if(i.startsWith("on")) events.push(i.substr(2));
}
events.forEach(function(eventName) {
element.addEventListener(eventName, log);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment