eventyoshi
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -179,2 +179,4 @@ var EventEmitter = require('events').EventEmitter | ||
if ((ev = this.__events[event]) !== undefined) { | ||
var found = false; | ||
for (var i = 0, l = ev.listeners.length; i < l; i++) { | ||
@@ -184,2 +186,3 @@ var l = ev.listeners[i]; | ||
(typeof l.listener === 'function' && l.listener === listener)) { | ||
found = true; | ||
break; | ||
@@ -189,2 +192,4 @@ } | ||
if (!found) return; | ||
this.children.forEach(function(ee) { | ||
@@ -252,1 +257,14 @@ ee.removeListener(event, ev.wrappers[i]); | ||
}; | ||
// | ||
// Proxy custom functions | ||
// | ||
yoshi.prototype.proxy = function(fn) { | ||
this[fn] = function() { | ||
var args = arguments; | ||
this.children.forEach(function(ee) { | ||
ee[fn].apply(ee, args); | ||
}); | ||
}; | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["event", "emitter", "eventemitter", "router", "proxy"], | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -5,3 +5,3 @@ # eventyoshi [![Build Status](https://secure.travis-ci.org/fent/node-eventyoshi.png)](http://travis-ci.org/fent/node-eventyoshi) | ||
![concept](https://github.com/fent/node-eventyoshi/raw/master/yoshi.png) | ||
![concept](https://github.com/fent/node-eventyoshi/raw/master/img/yoshi.png) | ||
@@ -70,3 +70,13 @@ # Usage | ||
### yoshi.proxy(fn) | ||
Proxies all calls from to `yoshi[fn]` to its children. | ||
```js | ||
yoshi.add(writeStream); | ||
yoshi.proxy('write'); | ||
yoshi.write(data); // this will call writeStream.write with data | ||
``` | ||
## Events | ||
@@ -73,0 +83,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54734
11
487
115