Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosylilly/eventemitter.js
To grant all object event function
https://github.com/rosylilly/eventemitter.js
Last synced: 5 days ago
JSON representation
To grant all object event function
- Host: GitHub
- URL: https://github.com/rosylilly/eventemitter.js
- Owner: rosylilly
- Created: 2011-07-29T18:05:57.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-26T04:37:09.000Z (over 13 years ago)
- Last Synced: 2024-12-22T13:14:51.749Z (15 days ago)
- Language: JavaScript
- Size: 89.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkd
Awesome Lists containing this project
README
# EventEmitter.js
var object = {};
EventEmitter.extends(object);object.addEventListener("sampleEvent", function(e){
alert(e); // => "sampleEvent"
});
object.emit("sampleEvent");function C(){};
C.prototype = new EventEmitter();
var cObject = new C();
cObject.addEventListener("sampleEvent", function(e, arg){
alert(arg) // => "Foo!!"
});
cObject.emit("sampleEvent", "Foo!!!");