Emit an event to all subscribers
Features:
Unsubscribe from an event
Event name
Event handler to remove
Subscribe to an event
Event name
Event handler
Unsubscribe function
Subscribe to an event for one-time execution
Event name
Event handler
Unsubscribe function
Remove all listeners for a specific event or all events
Optionalevent: keyof TOptional event name. If not provided, removes all listeners.
Type-safe event emitter implementation
Features:
Example