EventDispatcher <T>
Implements
Index
Constructors
constructor
Type parameters
- T = any
Returns EventDispatcher<T>
Methods
publicclear
Clears any existing handlers or wired event dispatchers on this event dispatcher
Returns void
publicemit
Emits an event for target
Parameters
eventName: string
The name of the event to publish
event: GameEvent<T, T>
Optionally pass an event data object to the handler
Returns void
publicoff
Unsubscribe an event handler(s) from an event. If a specific handler is specified for an event, only that handler will be unsubscribed. Otherwise all handlers will be unsubscribed for that event.
Parameters
eventName: string
The name of the event to unsubscribe
optionalhandler: (event: GameEvent<T, T>) => void
Optionally the specific handler to unsubscribe
Returns void
publicon
Subscribe an event handler to a particular event name, multiple handlers per event name are allowed.
Parameters
eventName: string
The name of the event to subscribe to
handler: (event: GameEvent<T, T>) => void
The handler callback to fire on this event
Returns void
publiconce
Once listens to an event one time, then unsubscribes from that event
Parameters
eventName: string
The name of the event to subscribe to once
handler: (event: GameEvent<T, T>) => void
The handler of the event that will be auto unsubscribed
Returns void
publicunwire
Unwires this event dispatcher from another
Parameters
eventDispatcher: EventDispatcher<any>
Returns void
publicwire
Wires this event dispatcher to also receive events from another
Parameters
eventDispatcher: EventDispatcher<any>
Returns void
Use EventEmitter will be removed in v0.29.0