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

@braintree/event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@braintree/event-emitter - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

4

CHANGELOG.md

@@ -0,3 +1,7 @@

# 0.2.0
* Add `off` method
# 0.1.0
* Initial release

@@ -15,2 +15,9 @@ 'use strict';

EventEmitter.prototype.off = function (event, callback) {
var eventCallbacks = this._events[event];
var indexOfCallback = eventCallbacks.indexOf(callback);
eventCallbacks.splice(indexOfCallback, 1);
};
EventEmitter.prototype._emit = function (event) {

@@ -17,0 +24,0 @@ var i, args;

2

package.json
{
"name": "@braintree/event-emitter",
"version": "0.1.0",
"version": "0.2.0",
"description": "A simple event emitter.",

@@ -5,0 +5,0 @@ "main": "event-emitter.js",

@@ -41,2 +41,14 @@ # event-emitter

### Unsubscribe from events
```js
var obj = new MyClass();
var cb = function () {};
obj.on('event-name', cb);
obj.off('event-name', cb);
obj._emit('event-name', {payload: 'foo'}); // cb is not called
```
## Tests

@@ -43,0 +55,0 @@

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