A tiny 200-byte functional event emitter and pubsub library for JavaScript.
Mitt is a tiny, functional event emitter and publish-subscribe library for JavaScript. It solves the problem of adding lightweight event-driven communication to applications without the overhead of larger libraries. With a size under 200 bytes gzipped, it provides a familiar API similar to Node's EventEmitter but in a minimal, dependency-free package.
JavaScript developers building applications that need efficient, lightweight event handling, particularly in performance-sensitive environments like browsers or embedded systems. It's also suitable for developers who prefer functional programming patterns.
Developers choose Mitt for its extreme minimalism and practicality—it offers essential event emitter functionality without any bloat. Its tiny size, familiar API, and functional design make it a reliable choice for projects where bundle size and simplicity are critical.
🥊 Tiny 200 byte functional event emitter / pubsub.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Weighs less than 200 bytes gzipped, making it one of the smallest event libraries available, ideal for performance-critical applications where bundle size is a top priority.
Includes a special '*' event type that listens to all events without manual registration for each, enabling effortless global event monitoring as highlighted in the README.
Uses the same on, off, and emit methods as Node's EventEmitter, reducing the learning curve for developers already accustomed to event-driven patterns in JavaScript.
Methods do not rely on 'this', making them easy to use in functional programming workflows and avoiding common context-binding issues in JavaScript.
Provides built-in TypeScript support with improved type inference, allowing for type-safe event handling as demonstrated in the documentation examples.
Lacks advanced capabilities such as once-only listeners, event bubbling, or async event handling, which are common in more comprehensive event libraries like EventEmitter3.
Does not provide mechanisms to catch or manage errors in event listeners, requiring developers to implement their own error handling to prevent unhandled exceptions.
Events are emitted synchronously by default, which can lead to performance bottlenecks or blocking behavior in high-throughput scenarios without careful manual async management.