event-spy

0.0.1 • Public • Published

Event Spy

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

Example

spy('click', function(e, fn) {
  console.log('caught', e.type, e.target);
 
  // pass through
  fn.call(this, e);
});

Installation

$ component install matthewmueller/event-spy

API

spy(type, fn)

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:
spy(fn);

spy#destroy()

Removes the spy

TODO

  • fix removeEventListener()
  • tests

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i event-spy

      Weekly Downloads

      1

      Version

      0.0.1

      License

      MIT

      Last publish

      Collaborators

      • mattmueller