spy on events

Event Spy

WIP event spy. Useful for debugging purposes. Must be initialized at the top of your script.

spy('click', function(efn) {
  console.log('caught', e.type, e.target);
  // pass through 
  fn.call(this, e);
$ component install matthewmueller/event-spy

Spy on events. type can either be a string or a regex. If no type given, spy watches all events.

  • mouseover and mousedown events:
spy(/(mouseover|mousedown)/, fn);
  • All events:

Removes the spy

  • fix removeEventListener()
  • tests