Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / listen

Function: listen()

listen<T>(target, event, options?): Atom<T>

Defined in: projects/libraries/streamix/src/lib/factories/listen.ts:14

Creates an atom that emits events of the specified type from the given EventTarget.

Type Parameters

T

T extends Event = Event

The type of the event to emit.

Parameters

target

MaybePromise<EventTarget>

The event target to listen to (or a promise that resolves to one).

event

MaybePromise<string>

The name of the event to listen for (or a promise that resolves to one).

options?

Optional event listener options.

boolean | AddEventListenerOptions

Returns

Atom<T>

An atom that emits the event objects as they occur.

Released under the GNU AGPL v3 or later.