Potentially outdated documentation
You're reading API reference for version 3.0.3. The latest stable release is version 3.1.0.
function on
thefrontside/effectionfunction on<T extends EventTarget, K extends EventList<T> | (string & {})>(target: T, name: K): Stream<EventTypeFromEventTarget<T, K>, never>
Create a 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
Stream<EventTypeFromEventTarget<T, K>, never>
a stream that will see one item for each event