包详细信息

component-event

component533.4kMIT0.2.1

Event binding component

browser, event, events

自述文件

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

更新日志

0.2.1 / 2022-12-23

  • package: add license to package.json
  • add missing LICENSE file

0.2.0 / 2016-09-22

  • [f1c2c3d2b1] - make requireable without window (Nathan Rajlich)

0.1.4 / 2014-05-27

  • component, package: add "browser" as a keyword
  • package: remove "repo" field

0.1.3 / 2014-02-10

  • package: rename module to "component-event"

0.1.2 / 2013-12-01

  • package: add "repository" field
  • check if addEventListener method is supported by the browser, just once
  • test: update to test in IE7+

0.1.1 / 2013-08-16

  • fix: default capture to false

0.1.0 / 2012-12-18

  • add returning of the callback function