Event map type mapping event names to their payload types.
Remove all listeners for every event.
Remove all listeners for a single event type.
The event name to clear.
Emit an event with a payload.
Each registered listener is called inside its own try/catch so that
an error in one handler does not prevent other handlers from running.
Errors are logged to console.error with an [ink-cartridge] prefix.
Subscribe to an event. Returns an unsubscribe function.
A function that unsubscribes this listener when called.
Get the number of subscribers for an event. Useful for debugging and testing.
The event name.
The number of registered listeners.
A typed event bus for decoupled communication between components.
Each handler in a given event is wrapped in try/catch so that one failing handler does not prevent the remaining handlers from running.
Example