ev-emitter
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -26,4 +26,5 @@ { | ||
"tests", | ||
"sandbox" | ||
"sandbox", | ||
"package.json" | ||
] | ||
} |
/** | ||
* EvEmitter v1.0.3 | ||
* EvEmitter v1.1.0 | ||
* Lil' event emitter | ||
@@ -107,4 +107,10 @@ * MIT License | ||
proto.allOff = | ||
proto.removeAllListeners = function() { | ||
delete this._events; | ||
delete this._onceEvents; | ||
}; | ||
return EvEmitter; | ||
})); |
{ | ||
"name": "ev-emitter", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "lil' event emitter", | ||
@@ -5,0 +5,0 @@ "main": "ev-emitter.js", |
@@ -20,3 +20,3 @@ # EvEmitter | ||
// single instance | ||
var emitter = new EventEmitter(); | ||
var emitter = new EvEmitter(); | ||
``` | ||
@@ -62,2 +62,12 @@ | ||
## allOff | ||
Removes all event listeners. Also aliased to `removeAllListeners`. | ||
``` js | ||
emitter.allOff() | ||
// or | ||
emitter.removeAllListeners() | ||
``` | ||
## Code example | ||
@@ -64,0 +74,0 @@ |
@@ -113,1 +113,23 @@ /* jshint node: true, unused: true, undef: true */ | ||
}); | ||
it( 'removes all listeners after removeAllListeners', function() { | ||
var emitter = new EvEmitter(); | ||
var ary = []; | ||
emitter.on( 'pop', function() { | ||
ary.push('a'); | ||
}); | ||
emitter.on( 'pop', function() { | ||
ary.push('b'); | ||
}); | ||
emitter.once( 'pop', function() { | ||
ary.push('c'); | ||
}); | ||
emitter.emitEvent('pop'); | ||
emitter.removeAllListeners(); | ||
// emitter.allOff(); | ||
emitter.emitEvent('pop'); | ||
assert.equal( ary.join(','), 'a,b,c', 'removeAllListeners removed listeners' ); | ||
}); |
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
9732
239
112