Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gustavohenrique/eventojs
An easy way to manipulate events on DOM
https://github.com/gustavohenrique/eventojs
Last synced: about 1 month ago
JSON representation
An easy way to manipulate events on DOM
- Host: GitHub
- URL: https://github.com/gustavohenrique/eventojs
- Owner: gustavohenrique
- Created: 2014-10-27T18:18:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-29T20:37:21.000Z (about 10 years ago)
- Last Synced: 2024-11-10T09:43:11.100Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 156 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
EventoJS
========Evento is a simple and easy library to works with javascript events.
You can add a custom events or the DOM events like click, mouseover, etc.## Installation
bower install eventojs
Or just add the `evento.js` in the HTML file.
## Usage
Just use `Evento.applyTo` for simple objects or `Evento.applyToHtml` for DOM elements.
### Simple objects
var person = {
name: Gustavo
};
Evento.applyTo(person);
person.bind('say', function (message) {
console.log(message);
});
person.trigger('say', 'hello!');### DOM elements
var button = document.querySelector('#myButton');
Evento.applyTo(button);
button.bind('click', function () {
console.log('Hello!!!');
});
button.trigger('click');## API
### bind
Binds a function on event
### trigger
Runs the function added by `bind`
### show
Removes the `hide` class
### hide
Adds the `hide` class that contains `display:none`
### addClass
Adds a css class
### removeClass
Removes a css class
## License
MIT