component-event

Event binding component

event

Element event binding component.

$ component install component/event
var events = require('event');
var a = document.querySelector('a');
 
function onclick(e) {
  e.preventDefault();
  console.log(e.target);
  events.unbind(a, 'click', onclick);
}
 
events.bind(a, 'click', onclick);

Bind to el's event type with callback, returns the callback passed.

Unbind el's event type callback, returns the callback passed.

MIT