LooseEventBus<C extends string = string, T extends string = string, P = any>
classType parameters
| Name | Type | Description |
|---|---|---|
C | extends string | |
T | extends string | |
P | — |
Constructor
constructor
Methods
clear
Removes **all** listeners (exact and pattern). Useful for tests/HMR teardown.
emit
Emits an event to all exact subscribers first, then to **matching pattern** subscribers. Duplicate handler references are called **once** (de-duped).
emitWith
Emits a payload that is only built if somebody is listening.
off
Unsubscribes an **exact** handler. The type key is normalized internally,
so callers can pass "foo" or ".foo" interchangeably.
on
Subscribes a handler to either an **exact** type or a **pattern**.