Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/event-manager
Higher level event management for abstract event handling mechanisms
https://github.com/component/event-manager
Last synced: 13 days ago
JSON representation
Higher level event management for abstract event handling mechanisms
- Host: GitHub
- URL: https://github.com/component/event-manager
- Owner: component
- Created: 2012-12-19T15:10:54.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-10-09T21:54:09.000Z (about 11 years ago)
- Last Synced: 2024-05-08T17:16:29.548Z (8 months ago)
- Language: JavaScript
- Size: 155 KB
- Stars: 2
- Watchers: 5
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# EventManager
__DEPRECATED__: this module is no longer recommended, [component/events](https://github.com/component/events)
now supports this functionality directly.Higher level event management designed to facilitate fluent
domain-specific event subscriptions.For example [component/events](https://github.com/component/events)
uses `EventManager` to provide fluent dom node event subsciptions,
while [component/delegates](https://github.com/component/delegates)
does the same, however for delegated events.## Installation
$ component install component/event-manager
## API
- [EventManager()](#eventmanager)
- [EventManager.onbind()](#eventmanageronbindfnfunction)
- [EventManager.onunbind()](#eventmanageronunbindfnfunction)
- [EventManager.bind()](#eventmanagerbindeventstringmethodstring)
- [EventManager.unbind()](#eventmanagerunbindeventstringmethodstring)## EventManager()
Initialize an `EventManager` with the given
`target` object which events will be bound to,
and the `obj` which will receive method calls.## EventManager.onbind(fn:Function)
Register bind function.
## EventManager.onunbind(fn:Function)
Register unbind function.
## EventManager.bind(event:String, [method]:String)
Bind to `event` with optional `method` name.
When `method` is undefined it becomes `event`
with the "on" prefix.```js
events.bind('login') // implies "onlogin"
events.bind('login', 'onLogin')
```## EventManager.unbind([event]:String, [method]:String)
Unbind a single binding, all bindings for `event`,
or all bindings within the manager.```js
evennts.unbind('login', 'onLogin')
evennts.unbind('login')
evennts.unbind()
```## License
MIT