Class: EventDispatcher<TData>
Defined in: events/event-dispatcher.ts:10
The EventDispatcher
class is responsible for managing event listeners
and dispatching events to those listeners. It allows adding, removing,
and dispatching events with associated data.
Type Parameters
TData
TData
The type of data associated with the events.
Constructors
Constructor
new EventDispatcher<
TData
>():EventDispatcher
<TData
>
Defined in: events/event-dispatcher.ts:19
Creates a new instance of the EventDispatcher
class.
Returns
EventDispatcher
<TData
>
Methods
addEventListener()
addEventListener(
type
,event
):void
Defined in: events/event-dispatcher.ts:29
Adds an event listener for the specified event type.
Parameters
type
string
The type of the event.
event
ParameterizedForgeEvent
<TData
>
The event listener to add.
Returns
void
dispatchEvent()
dispatchEvent(
type
,data
):void
Defined in: events/event-dispatcher.ts:59
Dispatches an event of the specified type to all registered listeners.
Parameters
type
string
The type of the event.
data
TData
The data associated with the event.
Returns
void
removeEventListener()
removeEventListener(
type
,event
):void
Defined in: events/event-dispatcher.ts:46
Removes an event listener for the specified event type.
Parameters
type
string
The type of the event.
event
ParameterizedForgeEvent
<TData
>
The event listener to remove.
Returns
void