event-emitter
Advanced tools
Comparing version
{ | ||
"name": "event-emitter", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Environment agnostic event emitter", | ||
@@ -20,7 +20,7 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
"dependencies": { | ||
"es5-ext": "~0.10.7", | ||
"d": "~0.1.1" | ||
"es5-ext": "~0.10.14", | ||
"d": "1" | ||
}, | ||
"devDependencies": { | ||
"tad": "~0.2.3", | ||
"tad": "~0.2.7", | ||
"xlint": "~0.2.2", | ||
@@ -27,0 +27,0 @@ "xlint-jslint-medikoo": "~0.1.4" |
@@ -7,3 +7,3 @@ # event-emitter | ||
$ npm install event-emitter | ||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) | ||
@@ -16,10 +16,13 @@ | ||
var emitter = ee({}), listener; | ||
var MyClass = function () { /* .. */ }; | ||
ee(MyClass.prototype); // All instances of MyClass will expose event-emitter interface | ||
var emitter = new MyClass(), listener; | ||
emitter.on('test', listener = function (args) { | ||
// …emitter logic | ||
// … react to 'test' event | ||
}); | ||
emitter.once('test', function (args) { | ||
// …invoked only once(!) | ||
// … react to first 'test' event (invoked only once!) | ||
}); | ||
@@ -68,3 +71,3 @@ | ||
Unifies event handling for two objects. Events emitted on _emitter1_ would be also emitter on _emitter2_, and other way back. | ||
Unifies event handling for two objects. Events emitted on _emitter1_ would be also emitted on _emitter2_, and other way back. | ||
Non reversible. | ||
@@ -71,0 +74,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27196
0.93%99
3.13%- Removed
- Removed
Updated
Updated