component-event
Event binding component
Last updated 11 years ago by tootallnate .
Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install component-event 
SYNC missed versions from official npm registry.

event

Element event binding component.

Installation

$ component install component/event

Example

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);

API

.bind(el, type, callback, [capture])

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

.unbind(el, type, callback, [capture])

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

License

MIT

Current Tags

  • 0.2.1                                ...           latest (2 years ago)

4 Versions

  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           11 years ago

Copyright 2013 - present © cnpmjs.org | Home |