Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/event
Event binding component
https://github.com/component/event
Last synced: 12 days ago
JSON representation
Event binding component
- Host: GitHub
- URL: https://github.com/component/event
- Owner: component
- License: mit
- Created: 2012-09-05T22:54:43.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T17:00:28.000Z (almost 2 years ago)
- Last Synced: 2024-12-12T19:04:38.489Z (15 days ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 37
- Watchers: 6
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# event
Element event binding component.
## Installation
$ component install component/event
## Example
```js
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