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

x/defer/src/event_handlers.d.ts>EventHandlersEventMap

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

Type Parameters

optional
T = unknown

Properties

fulfilled: FulfilledEvent<T>

Emitted when a Defer Promise instance is fulfilled, meaning it has fully resolved to a value without encountering an error. At the time of emission, the Promise's state will be "fulfilled".

resolved: FulfilledEvent<T>

Alias for settled | the 'fulfilled' event

rejected: RejectedEvent

Emitted when a Defer Promise instance is rejected, meaning it has encountered an error. At the time of emission, the Promise's state will be "rejected".

settled: SettledEvent<T>

Emitted when a Defer Promise instance is settled, meaning it has been either fulfilled or rejected. At the time of emission, the Promise's state will be either "fulfilled" or "rejected", indicating their outcome.

Note: This is fired after any "fulfilled" or "rejected" events.

statechange: StateChangeEvent

Emitted whenever a Defer Promise's state changes to a new value. This event is fired before any "fulfilled" or "rejected" events, and before the Promise is actually completely settled.