NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1027 most downloaded on npm
Simple and modern async event emitter
Last release 8 days ago
26 Sep 2026
Release timing varies
gaps range from 2 weeks to 1.2 years
Most releases are documented
notes for 28 of 35 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
35 releases · first in 2017
Improve TypeScript types cf2297d
Emittery.mixin() now returns a class type that includes the emittery property and the mixed-in methods.events() and .anyEvent() now type next() and return() precisely, instead of anyEmittery.listenerAdded and Emittery.listenerRemoved are now accepted everywhere the runtime accepts them, like .on(), .events(), and .listenerCount().emit() without data now works on an untyped emitter.bindMethods() now accepts any object, including a class instancemethodNames for Emittery.mixin() and .bindMethods() now only accepts real method names. A list typed as string[] needs as const or the new EmitteryMethodName type.next() is called concurrently 7157da9for await loop cannot leave the subscription behind..clearListeners() with one event name ending an .events() iterator that listens to several events 7157da9.anyEvent() yielding the internal listenerAdded and listenerRemoved events 7157da9listenerAdded and listenerRemoved firing when nothing changed 4987e5f
.on(), a repeated .off(), or .off() of a listener that was never added..off() with several event names stopping at the first error and leaving the rest subscribed 4987e5f.offAny() not removing the listener when the debug logger throws 4987e5f.on() changing when the event name array is mutated afterwards 4987e5f.clearListeners() removing every listener when given an invalid event name 51d4812
TypeError. Only undefined means "all events".debug options object sharing their debug settings 5b47694
emitter.debug.enabled instead of changing the object you passed in..emit() in environments without iterator helpers 4de0d10Emittery.mixin() silently overwriting an existing property with the same name as the emittery property 3702d31One column per quarter.
Listeners now receive a unified {name, data} object instead of raw data
{name, data} object instead of raw dataAll listeners (.on(), .onAny(), .once(), async iterators) now receive a single event object with name and data properties instead of the raw event data.
- emitter.on('🦄', data => {
- console.log(data);
+ emitter.on('🦄', ({data}) => {
+ console.log(data);
});For .onAny():
- emitter.onAny((eventName, eventData) => {
- console.log(eventName, eventData);
+ emitter.onAny(({name, data}) => {
+ console.log(name, data);
});For .once():
- const data = await emitter.once('🦄');
+ const {data} = await emitter.once('🦄');For .events() and .anyEvent() async iterators:
- for await (const data of emitter.events('🦄')) {
+ for await (const {data} of emitter.events('🦄')) {
console.log(data);
}
- for await (const [eventName, eventData] of emitter.anyEvent()) {
+ for await (const {name, data} of emitter.anyEvent()) {
…
}For predicates in .once():
- emitter.once('data', data => data.ok === true);
+ emitter.once('data', ({data}) => data.ok === true);emit() now throws AggregateError instead of rejecting with a single errorWhen multiple listeners throw, emit() now collects all errors into an AggregateError instead of silently dropping errors after the first one. All listeners always run to completion.
try {
await emitter.emit('event');
} catch (error) {
- // error was from the first listener that threw
+ // error is an AggregateError with all listener errors in error.errors
+ console.log(error.errors);
}The minimum required Node.js version is now 22 (previously 14.16).
init/deinit lifecycle hooks - Register setup/teardown logic that runs when the first listener subscribes and the last listener unsubscribes for a given event.Disposable support - Unsubscribe functions from .on() and .onAny() are now Disposable (usable with using for automatic cleanup).AsyncDisposable support - Async iterators from .events() and .anyEvent() are now AsyncDisposable (usable with await using).AbortSignal support for .events(), .anyEvent(), and .once() - Pass {signal} to cancel subscriptions externally..once() options object - Accepts {predicate, signal} in addition to a plain predicate function.Emittery.mixin() now works with both legacy and TC39 standard decorator syntax.emit() no longer silently drops errors from multiple listenersemitMetaEvent breaking async emit() overrides in subclassesProxyFix emitSerial() not delivering events to async iterators a3c04ca
Add support for filter predicate in once() (#124) 347c2cc
Add support for AbortController (#121) 86bde13
Fix compatibility with p-event (#115) 2eea7f7
p-event (#115) 2eea7f7Fix emitter.listenerCount() for symbol keys fad52b9
emitter.listenerCount() for symbol keys fad52b9Fix globalThis.process conflict in the browser (#107) 5133d6f
globalThis.process conflict in the browser (#107) 5133d6fThis package is now pure ESM. Please read this .
Emittery. are now named exports.Fix missing file in package (#104) 715e003
Internal: Properly clean up listener storage (#103) 3641e7a
Internal: Use a different approach to prevent consumers from emitting meta events (#98) c07c783
https://github.com/sindresorhus/emittery/compare/v0.12.0...v0.12.1
Add an off method to the promise returned from .once() (#100) e0b4ba7
off method to the promise returned from .once() (#100) e0b4ba7Emittery.mixin type support arguments in constructor 32ddcbehttps://github.com/sindresorhus/emittery/compare/v0.11.0...v0.12.0
Allow event names to be numbers (#96) c010e90
https://github.com/sindresorhus/emittery/compare/v0.10.2...v0.11.0
Fix handling of circular references in event data when using debug mode 8a2371c
https://github.com/sindresorhus/emittery/compare/v0.10.1...v0.10.2
Expose the OmnipresentEventData type (#93) 3e5bd10 2725900
OmnipresentEventData type (#93) 3e5bd10 2725900https://github.com/sindresorhus/emittery/compare/v0.10.0...v0.10.1
Fix support for typed subscriptions for multiple event names for .on() (#84) c4c11e4
.on() (#84) c4c11e4https://github.com/sindresorhus/emittery/compare/v0.9.2...v0.10.0
Fix browser compatibility (for real this time) 48bc0a9
https://github.com/sindresorhus/emittery/compare/v0.9.1...v0.9.2
Fix browser compatibility 30a859a
https://github.com/sindresorhus/emittery/compare/v0.9.0...v0.9.1
Add debug functionality (#53) 43b6deb
https://github.com/sindresorhus/emittery/compare/v0.8.1...v0.9.0
Fix support for typed subscriptions for multiple event names for .events() (#74) 53caa07
.events() (#74) 53caa07p-event package (#73) 30093fdhttps://github.com/sindresorhus/emittery/compare/v0.8.0...v0.8.1
Move the strongly-typed .Typed types into the main TypeScript types (#69) df35ea6
.Typed types into the main TypeScript types (#69) df35ea6Migrate:
-const emitter = new Emittery.Typed<{value: string}, 'open' | 'close'>();
+const emitter = new Emittery<
+ {
+ value: string,
+ open: undefined,
+ close: undefined
+ }
+>();
https://github.com/sindresorhus/emittery/compare/v0.7.2...v0.8.0
Add symbol to Emittery.mixin's emitteryPropertyName types (#65) 3c65ac5
symbol to Emittery.mixin's emitteryPropertyName types (#65) 3c65ac5https://github.com/sindresorhus/emittery/compare/v0.7.1...v0.7.2
Fix using symbol event names in iterator and clearListeners (#57) 3c082a2
https://github.com/sindresorhus/emittery/compare/v0.7.0...v0.7.1
Support listening to multiple events at the same time (#52) 3970fae
.emit() doesn't return a value (#56) 5e13246https://github.com/sindresorhus/emittery/compare/v0.6.0...v0.7.0
Allow symbol event names (#43) 8c6bd97
https://github.com/sindresorhus/emittery/compare/v0.5.1...v0.6.0
Fix the Events TypeScript type b132757
Events TypeScript type b132757https://github.com/sindresorhus/emittery/compare/v0.5.0...v0.5.1
Add subscription mechanism using async iterators (#40) 2baf580
bindMethods() method and a mixin() decorator for TypeScript users (#37) 96a2cb8https://github.com/sindresorhus/emittery/compare/v0.4.1...v0.5.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →