Birb / EventListener
Class: EventListener<E, F>
Type parameters
Name | Type |
---|---|
E | extends string |
F | extends Function |
Table of contents
Constructors
Methods
Constructors
constructor
• new EventListener<E
, F
>(parent
, event
)
Type parameters
Name | Type |
---|---|
E | extends string |
F | extends Function |
Parameters
Name | Type |
---|---|
parent | EventDispatcher <E > |
event | E |
Defined in
src/classes/EventListener.ts:10
Methods
do
▸ do(handler
): EventListener
<E
, F
>
Add a handler that should be called.
Parameters
Name | Type | Description |
---|---|---|
handler | F | The function. |
Returns
EventListener
<E
, F
>
The EventListener for chaining.
Defined in
src/classes/EventListener.ts:21
forget
▸ forget(): void
Forgets the EventListener, removing it from the EventDispatcher. This will result in the EventListener no longer being called when the parent EventDispatcher is used to dispatch an event.
Returns
void
Defined in
src/classes/EventListener.ts:57
once
▸ once(): EventListener
<E
, F
>
Sets the EventListener to only dispatch once. When the EventListener is dispatched, the forget()
method is called internally.
Returns
EventListener
<E
, F
>
The EventListener for chaining.
Defined in
src/classes/EventListener.ts:47