ee-event-emitter
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -43,3 +43,3 @@ !function(){ | ||
else if (event === 'error') { | ||
errs = Array.prototype.slice.call(args, 1).filter(function(a){ | ||
errs = Array.prototype.slice.call(args, 1).filter(function(a){ | ||
return a instanceof Error; | ||
@@ -87,3 +87,25 @@ }); | ||
/** | ||
* listens for an event and passes it directly to this | ||
* instance of the eventemitter | ||
* | ||
* @param {string} eventName the name of the event to emit | ||
* @returns {function} event listener that passes the event | ||
* to this class | ||
*/ | ||
, passEvent: function(eventName) { | ||
return function() { | ||
var args = [eventName]; | ||
// convert args to array (since Array.from or | ||
// the spread operator are not available yet) | ||
for (var i = 0, l = arguments.length; i < l; i++) args.push(arguments[i]); | ||
// emit what we got | ||
this.emit.apply(this, args); | ||
}.bind(this); | ||
} | ||
// add one ( two args ) or multiple events ( one arg -> object ). fired once. | ||
@@ -118,3 +140,3 @@ , once: function(event, listener) { | ||
// adds a listenr, somehow private | ||
, addListener: function(event, listener, once) { | ||
, addListener: function(event, listener, once) { | ||
if (!this.___events[event]) this.___events[event] = []; | ||
@@ -121,0 +143,0 @@ |
{ | ||
"name" : "ee-event-emitter" | ||
, "description" : "A portable event emitter class" | ||
, "version" : "0.2.2" | ||
, "version" : "0.3.0" | ||
, "homepage" : "https://github.com/eventEmitter/ee-event-emitter" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
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
9562
142