javascript - Listen to all events in Chrome browser -
i want listen events happen in site. use monitorevents() command, command prints event console, , want set callback function manipulations on data without printing console.
is there smart way this?
you can try this:
var eventslist = ["mousedown", "mouseup", "click", "dblclick", "mousemove", "mouseover", "mouseout", "mousewheel", "keydown", "keyup", "keypress", "textinput", "touchstart", "touchmove", "touchend", "touchcancel", "resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]; var callbackfunction = function(element, eventname) { console.log('triggered event ' + eventname); }; var elements = document.queryselectorall('*'); (var = 0; < elements.length; i++) { (var j = 0; j < eventslist.length; j++) { var element = elements[i]; var event = eventslist[j]; element.addeventlistener(event, callbackfunction.bind(this, element, event), true); } }
Comments
Post a Comment