Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@braintree/event-emitter
Advanced tools
A helper module for creating objects with event emitter capabilities.
npm
npm install --save @braintree/event-emitter
This module uses commonjs. You must use a build tool such as Browserify or Webpack to include it in your frontend project.
var EventEmitter = require('@braintree/event-emitter');
function MyClass () {
EventEmitter.call(this);
}
MyClass.prototype = EventEmitter.createChild(MyClass);
var obj = new MyClass();
obj.on('event-name', function (data) {
console.log('called with', data.payload, '!');
});
obj._emit('event-name', {payload: 'foo'}); // logs "called with foo!"
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
npm test
0.2.0
off
methodFAQs
A simple event emitter.
The npm package @braintree/event-emitter receives a total of 267,578 weekly downloads. As such, @braintree/event-emitter popularity was classified as popular.
We found that @braintree/event-emitter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.