nano-typed-emitter
v1.0.0
Published
Ultra-lightweight (~500 B), strictly typed pub/sub event emitter for TypeScript and JavaScript applications.
Maintainers
Readme
⚡ nano-typed-emitter
Ultra-lightweight (~500 B), strictly typed pub/sub event emitter for TypeScript and JavaScript applications.
🚀 Quick Start
import { createNanoEmitter } from 'nano-typed-emitter';
interface Events {
message: { text: string; sender: string };
status: 'online' | 'offline';
}
const emitter = createNanoEmitter<Events>();
// Listen to typed event
const unsubscribe = emitter.on('message', ({ text, sender }) => {
console.log(`[${sender}]: ${text}`);
});
// Emit with strict payload checking
emitter.emit('message', { text: 'Hello!', sender: 'Alice' });
// Stop listening
unsubscribe();💖 Support the Project
If you find this package useful, consider sponsoring its ongoing development: 👉 Sponsor @Piratha97 on GitHub Sponsors
📄 License
MIT © 2026 Pirapaakaran Pirathapan
