developit/mitt ? reverse-engineered prompt
Reverse engineered prompt
Build me a tiny event emitter library for JavaScript and TypeScript that I can use in the browser or any runtime. I want it to feel simple and familiar, like Node style event handling, but really small and dependency free.
It should let me create an emitter, subscribe to named events, unsubscribe later with the same handler, and fire events with any value I pass in. I also want a special wildcard listener that can hear every event, with the event name included. Please make it work cleanly with TypeScript so event names and payloads can be typed, and the common cases feel nicely inferred.
Keep the public API very small and easy to read, and make sure it supports clearing listeners too. If you need to check current best practices or docs online while building it, go ahead.
Are you gonna build this?
make sure you review the code using coderabbit