Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ev-emitter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ev-emitter - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

3

bower.json

@@ -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' );
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc