
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
tiny-emitter
Advanced tools
A tiny (less than 1k) event emitter library.
npm install tiny-emitter --save
var Emitter = require('tiny-emitter');
var emitter = new Emitter();
emitter.on('some-event', function (arg1, arg2, arg3) {
//
});
emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');
Alternatively, you can skip the initialization step by requiring tiny-emitter/instance instead. This pulls in an already initialized emitter.
var emitter = require('tiny-emitter/instance');
emitter.on('some-event', function (arg1, arg2, arg3) {
//
});
emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');
Subscribe to an event
event - the name of the event to subscribe tocallback - the function to call when event is emittedcontext - (OPTIONAL) - the context to bind the event callback toSubscribe to an event only once
event - the name of the event to subscribe tocallback - the function to call when event is emittedcontext - (OPTIONAL) - the context to bind the event callback toUnsubscribe from an event or all events. If no callback is provided, it unsubscribes you from all events.
event - the name of the event to unsubscribe fromcallback - the function used when binding to the eventTrigger a named event
event - the event name to emitarguments... - any number of arguments to pass to the event subscribersBuild (Tests, Browserifies, and minifies)
npm install
npm run build
Test
npm install
npm test
EventEmitter3 is a high performance EventEmitter. It has a similar API to tiny-emitter but is optimized for performance and has no dependencies.
Wolfy87's EventEmitter is an implementation of the EventEmitter module found in Node.js but for the browser. It offers additional features like namespacing events, but it's larger in size compared to tiny-emitter.
Mitt is a tiny functional event emitter/listener with a similar scope to tiny-emitter but with an even smaller footprint and no class syntax. It's ES6 module compatible and can be a good alternative for those who prefer functional paradigms.
FAQs
A tiny (less than 1k) event emitter library
The npm package tiny-emitter receives a total of 3,920,622 weekly downloads. As such, tiny-emitter popularity was classified as popular.
We found that tiny-emitter demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.