Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

fromEvent

import { fromEvent } from "https://raw.githubusercontent.com/surma/observables-with-streams/28c55be6d855780c677fd1f4ba975f4d3144891d/src/index.ts";

Creates an observable from an EventTarget. Each event is turned into an item for the observable.

function fromEvent<K extends EventTarget, T extends Event = Event>(
el: K,
name: string,
options?: boolean | AddEventListenerOptions,
): Observable<T>;
§
fromEvent<K extends EventTarget, T extends Event = Event>(el: K, name: string, options?: boolean | AddEventListenerOptions): Observable<T>
[src]

§Type Parameters

§
K extends EventTarget
[src]
§
T extends Event = Event
[src]

§Parameters

§
el: K
[src]

Event target to create an observable from.

§
name: string
[src]

Name of the event to listen to, such as 'click'.

§
options?: boolean | AddEventListenerOptions optional
[src]

§Return Type

§

New observable that emits values from the event target.