A minimal JavaScript event emitter library with a 108-byte footprint and TypeScript support.
Nano Events is a minimal event emitter library for JavaScript that provides a simple API for managing custom events. It solves the problem of adding event-driven architecture to applications without the overhead of larger libraries, focusing on a tiny code footprint and developer convenience.
JavaScript and TypeScript developers who need a lightweight, no-frills event system for frontend applications, Node.js projects, or libraries where bundle size is critical.
Developers choose Nano Events for its extreme minimalism (108 bytes), clean API that eliminates callback reference management, and first-class TypeScript support, making it ideal for performance-sensitive projects.
Simple and tiny (107 bytes) event emitter library for JavaScript
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
At only 108 bytes minified and brotlied, it has negligible impact on bundle size, controlled via Size Limit, making it ideal for performance-critical projects.
The `on` method returns an `unbind` function, eliminating the need to store callback references for removal, simplifying listener management as shown in the README examples.
Full TypeScript support with event type mapping provides compile-time safety for event names and arguments, reducing runtime errors, as demonstrated in the TypeScript section.
With just `emit` and `on` methods, the API is focused and straightforward, avoiding aliases and Node.js EventEmitter compatibility overhead for minimal complexity.
It lacks built-in utilities like 'once' listeners and a proper removeAllListeners method, requiring manual implementation as admitted in the README's 'Once' and 'Remove All Listeners' sections.
Being minimal, it offers no plugins or extended features such as error handling or wildcard events, so additional functionality must be built from scratch.
Adding common features like once listeners involves writing custom code, which can increase development overhead compared to more comprehensive libraries.