# eventemitter3

> EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.

Latest version **5.0.4** (published 2026-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install eventemitter3
pnpm add eventemitter3
yarn add eventemitter3
bun add eventemitter3
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.4 |
| Published | 2026-01-19 |
| First published | 2013-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 72.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3539 |
| Author | Arnout Kazemier |
| Maintainers | v1, lpinca, 3rdeden |
| Keywords | EventEmitter, EventEmitter2, EventEmitter3, Events, addEventListener, addListener, emit, emits, emitter, event, once, pub/sub, publish, reactor, subscribe |

## Links

- npm: https://www.npmjs.com/package/eventemitter3
- Repository: https://github.com/primus/eventemitter3
- Homepage: https://github.com/primus/eventemitter3#readme
- Issues: https://github.com/primus/eventemitter3/issues
- npm.io page: https://npm.io/package/eventemitter3

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 5.0.4 (latest) — 2026-01-19
- 5.0.3 — 2026-01-19
- 5.0.2 — 2026-01-19
- 5.0.1 — 2023-04-30
- 5.0.0 — 2022-11-28
- 4.0.7 — 2020-08-27
- 4.0.6 — 2020-08-25
- 4.0.5 — 2020-08-22
- 4.0.4 — 2020-05-12
- 4.0.3 — 2020-05-11
- 4.0.2 — 2020-05-11
- 4.0.1 — 2020-05-10
- 4.0.0 — 2019-06-19
- 3.1.2 — 2019-04-30
- 3.1.1 — 2019-04-29
- … 23 more at https://npm.io/package/eventemitter3/versions

## README

# EventEmitter3

[![Version npm](https://img.shields.io/npm/v/eventemitter3.svg?style=flat-square)](https://www.npmjs.com/package/eventemitter3)[![CI](https://img.shields.io/github/actions/workflow/status/primus/eventemitter3/ci.yml?branch=master&label=CI&style=flat-square)](https://github.com/primus/eventemitter3/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://img.shields.io/coveralls/primus/eventemitter3/master.svg?style=flat-square)](https://coveralls.io/r/primus/eventemitter3?branch=master)

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

```bash
$ npm install --save eventemitter3
```

## CDN

Recommended CDN:

```text
https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js
```

## Usage

After installation the only thing you need to do is require the module:

```js
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.

```js
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](LICENSE)

---
_Source: https://npm.io/package/eventemitter3 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
