Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mucsi96/eventpublisher.js
Nano Event Publisher for JavaScript
https://github.com/mucsi96/eventpublisher.js
Last synced: 5 days ago
JSON representation
Nano Event Publisher for JavaScript
- Host: GitHub
- URL: https://github.com/mucsi96/eventpublisher.js
- Owner: mucsi96
- Created: 2014-02-27T12:21:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-12T12:12:27.000Z (over 10 years ago)
- Last Synced: 2024-10-12T03:13:07.261Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 195 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Nano Event Publisher
====================
ep.publish(eventName, moduleName, data)
---------------------------------------
Publish named event from given module and passes the data object to event handler parameter object on .data path**Parameters**
**eventName**: *string*, events name
**moduleName**: *string*, module name
**data**: *object*, data object passed to event handlers on .data path
**Returns**
*object*, jQuery promise
ep.subscribe(eventName, moduleName, callback)
---------------------------------------------
Subscribes on a given module given event with a callback function. If module name or event name is null all module events or given module every event will trigger the callback respectively**Parameters**
**eventName**: *string*, events name
**moduleName**: *string*, modules name
**callback**: *function*, event handler function. As parameter it will get an object containing: triggering module name, event name, data, jQuery deferred
ep.unsubscribeAll(eventName, moduleName)
----------------------------------------
Unsubscribes from a given module given event all event handlers**Parameters**
**eventName**: *string*, event name
**moduleName**: *string*, module name
ep.unsubscribe(eventName, moduleName, callback)
-----------------------------------------------
Unsubscribes from a given module given event given event handler**Parameters**
**eventName**: *string*, event name
**moduleName**: *string*, module name
**callback**: *function*, event handler
ep.reset()
----------
Resets own state to initial. Forgets every registered subscriptions. Useful for testing.