If you really want to do this, you can override addEventListener to track logged and triggered events.
var myEventManager = (function() { var old = EventTarget.prototype.addEventListener, listeners = [], events = []; EventTarget.prototype.addEventListener = function(type, listener) { function new_listener(listener) { return function(e) { events.push(e);
However, there is no reason not to do this, not least because you quickly run out of memory when recording thousands of events, such as mouse movements. It also will not cause event listeners to be installed in ways like elt.onclick . Of course, they will not catch listeners configured through the old attachEvent IE attachEvent . Most importantly, it will not help you that events that are generated and listened for internal use, such as a mouse click on a checkbox. (A complete solution will also require removeEventListener processing.)
You can also override createEvent and dispatch same way, but again, this will only capture events that are explicitly created or dispatched in JS code.
If you really want to do what you think is desirable, I think you need to unlock Chrome.
user663031
source share