Skip to main content

Signal

@akhaled01/voidDocs


@akhaled01/void / signal / Signal

Class: Signal

Constructors

new Signal()

new Signal(): Signal

Returns

Signal

Methods

listen()

static listen<T>(target, eventName, callback): () => void

Subscribe to a native event on a DOM element.

Type Parameters

T extends DocumentEventNames

Parameters

target: DOMNode

The target DOM node (Document or HTMLElement).

eventName: T

The name of the event to listen for.

callback

The callback function to invoke when the event occurs.

Returns

Function

A cleanup function to unsubscribe from the event.

Returns

void

Defined in

signal.ts:37


listenMultiple()

static listenMultiple<T>(target, eventNames, callback): () => void

Listen for multiple events on a target.

Type Parameters

T extends DocumentEventNames

Parameters

target: DOMNode

The target DOM node (Document or HTMLElement).

eventNames: T[]

An array of event names to listen for.

callback

The callback function to invoke when any of the events occur.

Returns

Function

A cleanup function to unsubscribe from all events.

Returns

void

Defined in

signal.ts:55


trigger()

static trigger(target, eventName): void

Trigger a native event programmatically.

Parameters

target: DOMNode

The target DOM node (Document or HTMLElement).

eventName: DocumentEventNames

The name of the event to trigger.

Returns

void

Defined in

signal.ts:72