eemitt
v3.0.1
Published
A lightweight, TypeScript-native event emitter library supporting modular event listeners, one-time triggers, propagation control, and more.
Downloads
12
Readme
eemitt
A lightweight, TypeScript-native event emitter library supporting modular event listeners, one-time triggers, propagation control, and more.
Features
- TypeScript Support: Full type definitions and generic support
- High Performance: Minimal memory and execution overhead
- Propagation Control:
stopImmediatePropagation()halts further listener execution - Flexible Binding: Supports batch event operations
- Mixin Mode: Inject event capabilities into any object using
mixin - Custom Event Data: Pass complex data via
EventTypeobjects
Documentation
For detailed usage instructions and API references, please visit the official documentation:
Quick Start
Basic Usage
import { Emitter } from 'eemitt';
// Create event emitter
const emitter = new Emitter();
// Add listener
emitter.on('message', (evt) => {
console.log('Received message:', evt.payload);
});
// Emit event with data
emitter.emit({ type: 'message', payload: 'Hello World' });
// Output: Received message: Hello WorldContributing
We welcome contributions from the community! If you find a bug or want to suggest an improvement, feel free to open an issue or submit a pull request.
How to Contribute
- Fork the repository.
- Create a new branch for your changes.
- Submit a pull request with a clear description of your changes.
License
This project is licensed under the MIT License.
Browser Support
|
|
|
|
|
--- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |

