component-event

0.2.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i component-event

Weekly Downloads

131,474

Version

0.2.1

License

MIT

Unpacked Size

4.8 kB

Total Files

8

Last publish

Collaborators

  • coreh
  • swatinem
  • timaschew
  • anthonyshort
  • ianstormtaylor
  • nami-doc
  • clintwood
  • cristiandouce
  • stagas
  • rauchg
  • kelonye
  • amasad
  • trevorgerhardt
  • juliangruber
  • thehydroimpulse
  • dominicbarnes
  • dfcreative
  • mattmueller
  • tootallnate
  • yields
  • stephenmathieson
  • retrofox
  • tjholowaychuk
  • hughsk
  • jonathanong
  • jongleberry
  • forbeslindesay
  • calvinfo
  • defunctzombie