Shannon_mu 9ea635a2dc 停车场 2 年之前
..
test 9ea635a2dc 停车场 2 年之前
.npmignore 9ea635a2dc 停车场 2 年之前
History.md 9ea635a2dc 停车场 2 年之前
Makefile 9ea635a2dc 停车场 2 年之前
Readme.md 9ea635a2dc 停车场 2 年之前
component.json 9ea635a2dc 停车场 2 年之前
index.js 9ea635a2dc 停车场 2 年之前
package.json 9ea635a2dc 停车场 2 年之前

Readme.md

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