Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/stream_observables/mod.ts>fromEvent

A collection of observables built with ReadableStreams & friends.
Latest
function fromEvent
import { fromEvent } from "https://deno.land/x/stream_observables@v1.3/mod.ts";

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

Type Parameters

K extends EventTarget
optional
T extends Event = Event

Parameters

el: K

Event target to create an observable from.

name: string

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

optional
options: boolean | AddEventListenerOptions

Returns

New observable that emits values from the event target.