component-event
Event binding component
Last updated 4 years ago by tootallnate .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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.0                                ...           latest (4 years ago)

3 Versions

  • 0.2.0                                ...           4 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           7 years ago
Downloads
Today 28
This Week 2,767
This Month 6,743
Last Day 152
Last Week 2,486
Last Month 12,427
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (112)

Copyright 2014 - 2017 © taobao.org |