addListener()
ts
function addListener(
target,
name,
actions): void;Defined in: functions/internals.ts:59
Internal
Registers an event listener on a target and links it to exposable functions.
This function:
- Resolves the target (element, window, or reference name)
- Creates a listener that executes ExposableFn actions
- Injects the DOM event into function arguments when requested
- Stores the listener internally for later removal
Parameters
| Parameter | Type | Description |
|---|---|---|
target | string | HTMLElement | Window | null | Target element, window, or reference name |
name | keyof GlobalEventHandlersEventMap | Event name |
actions | ExposableFn[] | Functions to execute when the event fires |
Returns
void
Remarks
- Existing listeners for the same target and event will be replaced
- Event arguments are injected via
arg.type === "event"
Since
1.0.0
Author
David Schummer
Author
Simon Kovtyk