Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/elo
Lo-fi JavaScript events module.
https://github.com/ryanve/elo
Last synced: about 1 month ago
JSON representation
Lo-fi JavaScript events module.
- Host: GitHub
- URL: https://github.com/ryanve/elo
- Owner: ryanve
- Created: 2012-06-19T18:41:24.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-12-16T20:40:52.000Z (almost 10 years ago)
- Last Synced: 2024-10-06T04:06:09.198Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://elo.airve.com
- Size: 324 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# [elo](../../)
#### elo is a lo-fi cross-browser JavaScript events API that gzips <3k. It's an events library for minimalists. It works as a standalone library or can integrate into a host such as [ender](https://github.com/ender-js/).
## API ([1.6](../../releases))
**elo** does not claim the `$` namespace, however it can be used as such in a closure.
### Methods
#### Events
- `$.on(element, eventName, handler)`
- `$.off(element, eventName, handler)`
- `$.one(element, eventName, handler)`
- `$.trigger(element, eventName, extraParamsArray?)`
- `$.domReady(fn)` // call `fn` when the DOM is ready
- `$.hasEvent(eventName, element|tagName?)`
- `$(stack).on(eventName, handler)`
- `$(stack).off(eventName, handler)`
- `$(stack).one(eventName, handler)`
- `$(stack).trigger(eventName, extraParamsArray?)`
- `$(document).ready(fn)`
- `$.fn.dubEvent(shorthandEventNames)`#### Data
- `$.data(object, key?, value?)`
- `$.removeData(object, keys?)`
- `$.cleanData(object)`
- `$(stack).data(key, value?)`
- `$(stack).removeData(keys)`#### Utils
- `$.each(stack, callback, thisArg?, breaker?)`
- `$(stack).each(callback, thisArg?, breaker?)`### elo()
The `elo()` function is a simple OO **wrapper** that works very much like the jQuery function.
- `elo(element)` // wrap a DOM element
- `elo(stack)` // wrap NodeList or array
- `elo(selector, context)` // match a selector string via `querySelectorAll`
- `elo(fn)` // ready shortcut - `fn` calls like `fn.call(document, elo)`## Compatibility
Supports all major browsers. Tested in: Chrome, FF3+, Opera, IE7+, Safari. Please [report issues here](../../issues).
## License: [MIT](http://en.wikipedia.org/wiki/MIT_License)
Copyright (C) 2012 by [Ryan Van Etten](https://github.com/ryanve)