// the find
developit/mitt
🥊 Tiny 200 byte functional event emitter / pubsub.
Mitt is a 200-byte event emitter that covers the basic on/off/emit pattern with a wildcard listener for all events. It's for anyone who needs simple pubsub in a browser or Node context without pulling in a heavier dependency. The TypeScript generics for event maps are a genuine selling point for typed projects.
The typed event map API is well-designed — you define your event schema once and get type errors at the emit and handler sites. The wildcard '*' handler is genuinely useful for debugging or middleware-style logging without monkey-patching. Methods don't rely on 'this', so you can destructure or pass them around without binding. At 200 bytes gzipped, it won't show up in any bundle analysis.
No once() method — you have to wrap off() manually, which is tedious and easy to get wrong. No error handling: if a handler throws, it propagates synchronously and blows up remaining handlers in the queue. No priority or ordering guarantees, which matters when you need initialization order to be predictable. The project has had essentially no commits since mid-2024 and the issue tracker has open feature requests that aren't being addressed.