events
Element event binding component with support for single elements as well as NodeLists, HTMLCollections and Arrays. Based on visionmedia's component/event.
Component
Built to be used with the Component package manager. Read more here:
Installation
$ component install javve/events
Example
var events = require('events');
var links = document.getElementsByTagName('a');
function onclick(e) {
e.preventDefault();
console.log(e.target);
events.unbind(e.target, 'click', onclick);
}
events.bind(links, 'click', onclick);
API
.bind(els, type, callback, [capture])
Bind to el
's event type
with callback
.
.unbind(els, type, callback, [capture])
Unbind el
's event type
callback
.
License
MIT