jstd-web/node_modules/component-event
liang.chao ae9cf31198 Initial commit 2025-11-25 15:23:22 +08:00
..
test Initial commit 2025-11-25 15:23:22 +08:00
History.md Initial commit 2025-11-25 15:23:22 +08:00
LICENSE Initial commit 2025-11-25 15:23:22 +08:00
Makefile Initial commit 2025-11-25 15:23:22 +08:00
Readme.md Initial commit 2025-11-25 15:23:22 +08:00
component.json Initial commit 2025-11-25 15:23:22 +08:00
index.js Initial commit 2025-11-25 15:23:22 +08:00
package.json Initial commit 2025-11-25 15:23:22 +08:00

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