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

x/defer/src/event_listeners.d.ts>EventListeners

Robust TypeScript API for deferred handling of Promises. Supports event listeners and custom state-specific callbacks.
Latest
interface EventListeners
import { type EventListeners } from "https://deno.land/x/defer@0.6.0/src/event_listeners.d.ts";

Type Parameters

optional
T = unknown

Methods

addEventListener<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
dispatchEvent<K extends keyof EventHandlersEventMap<T>>(event: EventHandlersEventMap<T>[K]): boolean
dispatchEvent(event: Event): boolean
addListener<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | AddEventListenerOptions,
): void
addListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeListener<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | EventListenerOptions,
): void
removeListener(
type: string,
options?: boolean | EventListenerOptions,
): void
fire<K extends keyof EventHandlersEventMap<T>>(event: EventHandlersEventMap<T>[K]): boolean
fire(event: Event): boolean
on<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | AddEventListenerOptions,
): void
on(
type: string,
options?: boolean | AddEventListenerOptions,
): void
off<K extends keyof EventHandlersEventMap<T>>(
type: K,
listener: (this: Defer<T>, ev: EventHandlersEventMap<T>[K]) => void,
options?: boolean | EventListenerOptions,
): void
off(
type: string,
options?: boolean | EventListenerOptions,
): void
emit<K extends keyof EventHandlersEventMap<T>>(event: EventHandlersEventMap<T>[K]): boolean
emit(event: Event): boolean