Effection Logo

function on

thefrontside/effection

function on<T extends EventTarget, K extends EventList<T> | (string & {})>(target: T, name: K): Stream<EventTypeFromEventTarget<T, K>, never>

Create a https://effection-www-7a79x8qmc0zv.deno.dev/api/v3/Stream of events from any EventTarget.

See the guide on Streams and Subscriptions for details on how to use streams.

Type Parameters

T extends EventTarget

K extends EventList<T> | string & {}

Parameters

target: T

  • the event target whose events will be streamed

name: K

  • the name of the event to stream. E.g. "click"

Return Type

https://effection-www-7a79x8qmc0zv.deno.dev/api/v3/Stream&lt;EventTypeFromEventTarget&lt;T, K>, never>

a stream that will see one item for each event