Event binding component
JavaScript HTML Makefile
Latest commit 4d398f8 Sep 22, 2016 @TooTallNate TooTallNate Release 0.2.0
Permalink
Failed to load latest commit information.
test Update file to test in IE7+ Nov 11, 2013
.gitignore Initial commit Oct 6, 2012
History.md Release 0.2.0 Sep 22, 2016
Makefile Initial commit Oct 6, 2012
Readme.md Release 0.1.0 Dec 19, 2012
component.json Release 0.2.0 Sep 22, 2016
index.js make requireable without `window` Sep 22, 2016
package.json Release 0.2.0 Sep 22, 2016

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