on
on<
T,K>(topic,listener): () =>void
Defined in: astrobase/src/events/events.ts:61
Subscribes a callback to an event topic.
Type Parameters
Section titled “Type Parameters”A map of topic names and their emitted value types.
K extends string | number | symbol = keyof T
The topic name to subscribe to.
Parameters
Section titled “Parameters”K
The topic name to subscribe to.
listener
Section titled “listener”Listener<T[K]>
A listener callback function that will be invoked each time an event is emitted.
Returns
Section titled “Returns”A function that directly unsubscribes the listener without needing to manually invoke off.
():
void
Returns
Section titled “Returns”void