Skip to content

Latest commit

 

History

History
executable file
·
44 lines (28 loc) · 1.07 KB

Readme.md

File metadata and controls

executable file
·
44 lines (28 loc) · 1.07 KB

web component logo

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