Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/effection/lib/events.ts>once

Structured concurrency and effects for JavaScript
Latest
function once
import { once } from "https://deno.land/x/effection@4.0.0-alpha.1/lib/events.ts";

Create an Operation that yields the next event to be emitted by an EventTarget.

Type Parameters

T extends EventTarget
K extends EventList<T> | (string & { })

Parameters

target: T
  • the event target to be watched
name: K
  • the name of the event to watch. E.g. "click"

Returns

Operation<EventTypeFromEventTarget<T, K>>

an Operation that yields the next emitted event