WIP event spy. Useful for debugging purposes. Must be initialized at the top of your script.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
component.json
index.js
package.json

Readme.md

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