EventEmitter3 is a high performance, MIT licensed event emitter library for JavaScript that is API compatible with the Node.js built-in EventEmitter and intended for Node.js and browser developers who need faster event handling without rewriting existing event code.
What it is
EventEmitter3 is an npm package for Node.js and browser environments. It is a high performance EventEmitter micro-optimized for various code paths, and the README positions it as one of, if not the fastest EventEmitter available for Node.js and browsers. The implementation is written in EcmaScript 3 so it works in the oldest browsers and Node versions that a project needs to support. Its topic list names browser, eventemitter, and nodejs, and the module is API compatible with the EventEmitter that ships by default with Node.js. It is a drop in replacement for existing EventEmitters, but faster.
The concrete problem is that code using the Node.js built-in EventEmitter can pay avoidable overhead in hot event paths. EventEmitter3 replaces that default emitter with a micro-optimized implementation while keeping the familiar event API, so existing EventEmitter usage can switch without large rewrites. There are deliberate API differences: domain support has been removed; it does not throw an error when an error event is emitted and nobody is listening; the newListener and removeListener events have been removed; setMaxListeners, getMaxListeners, prependListener, and prependOnceListener are not available; custom context is supported for events so fn.bind is unnecessary; and removeListener removes all matching listeners, not only the first. The GitHub description notes that there is also a number 2 and that it is faster.
Key capabilities
- API compatible with Node.js built-in EventEmitter; drop in replacement for existing EventEmitters.
- Micro-optimized code paths make it one of, if not the fastest EventEmitter available for Node.js and browsers, per README.
- EcmaScript 3 implementation supports oldest browsers and Node versions.
- Contextual emits: EventEmitter.on, EventEmitter.once, and EventEmitter.removeListener accept extra context argument for this value, avoiding fn.bind.
- removeListener removes all matching listeners, not only first.
- Browser UMD build available from recommended CDN: https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js
- Documented omissions: domain support, throw on unhandled error event, newListener and removeListener events, setMaxListeners, getMaxListeners, prependListener, prependOnceListener.
Who uses it and how
- Node.js developers who want same EventEmitter API with faster event handling replace built-in emitter by requiring eventemitter3.
- Browser developers load UMD minified build from unpkg CDN for event-driven front-end code.
- Library and framework authors who need EventEmitter compatibility across Node.js and browsers, including oldest supported versions, adopt ES3 implementation.
- Projects already using on, once, emit, and removeListener with Node.js semantics can migrate without rewriting event code.
- Contributors clone GitHub repository to run npm test for tests and npm run benchmark for benchmarks; tests and benchmarks are not included in npm package, and benchmark run requires extra npm i in benchmarks folder.
Getting started
Install with npm install --save eventemitter3, then require eventemitter3 to create EventEmitter instances. For browsers, the recommended CDN is https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js.
How it compares
EventEmitter3 occupies the same niche as the Node.js built-in EventEmitter and presents itself as a drop in replacement for it. It preserves API compatibility while dropping domain support, not throwing when an error event has no listener, omitting newListener and removeListener events, omitting setMaxListeners, getMaxListeners, prependListener, and prependOnceListener, and changing removeListener to remove all matching listeners instead of only the first.
When to use it — and when not to
Use it when Node.js or browser code needs faster event handling and can accept the documented API differences. Projects that depend on domain support, automatic throw for unhandled error events, newListener or removeListener events, max listener methods, prepend methods, or remove-first-only semantics should stay with the Node.js built-in EventEmitter or another emitter. There is no database, storage, or SMTP to operate because this is a library, but tests and benchmarks are not shipped in the npm package, so contributors must clone the GitHub repository, and the benchmark run needs an extra npm i in the benchmarks folder; the repository shows 3,538 stars, 236 forks, 22 open issues, and last push on 2026-01-19.
project readme (upstream, from github) — read inline
EventEmitter3



EventEmitter3 is a high performance EventEmitter. It has been micro-optimized
for various of code paths making this, one of, if not the fastest EventEmitter
available for Node.js and browsers. The module is API compatible with the
EventEmitter that ships by default with Node.js but there are some slight
differences:
- Domain support has been removed.
- We do not
throw an error when you emit an error event and nobody is
listening.
- The
newListener and removeListener events have been removed as they
are useful only in some uncommon use-cases.
- The
setMaxListeners, getMaxListeners, prependListener and
prependOnceListener methods are not available.
- Support for custom context for events so there is no need to use
fn.bind.
- The
removeListener method removes all matching listeners, not only the
first.
It's a drop in replacement for existing EventEmitters, but just faster. Free
performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3
so it will work in the oldest browsers and node versions that you need to
support.
Installation
$ npm install --save eventemitter3
CDN
Recommended CDN:
https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js
Usage
After installation the only thing you need to do is require the module:
var EventEmitter = require('eventemitter3');
And you're ready to create your own EventEmitter instances. For the API
documentation, please follow the official Node.js documentation:
http://nodejs.org/api/events.html
Contextual emits
We've upgraded the API of the EventEmitter.on, EventEmitter.once and
EventEmitter.removeListener to accept an extra argument which is the context
or this value that should be set for the emitted events. This means you no
longer have the overhead of an event that required fn.bind in order to get a
custom this value.
var EE = new EventEmitter()
, context = { foo: 'bar' };
function emitted() {
console.log(this === context); // true
}
EE.once('event-name', emitted, context);
EE.on('another-event', emitted, context);
EE.removeListener('another-event', emitted, context);
Tests and benchmarks
To run tests run npm test. To run the benchmarks run npm run benchmark.
Tests and benchmarks are not included in the npm package. If you want to play
with them you have to clone the GitHub repository. Note that you will have to
run an additional npm i in the benchmarks folder before npm run benchmark.
License
MIT