Skip to main content
Module

x/texa/src/deps.ts>Event

A Deno web framework inspired by Oak and Express. Built-in support for WebSockets, middleware and routing.
Latest
class Event
import { Event } from "https://deno.land/x/texa@0.8.1/src/deps.ts";

A subscribable event.

Type Parameters

optional
T extends unknown[] = []

Properties

private
readonly
_subscriptions: Map<Subscription<T>, boolean>

The listeners that are currently subscribed to the event.

Methods

dispatch(...args: T)

Fire the event and call all subscriptions.

pull(): Promise<T>

Pull the next dispatch from the event return the dispatched data.

subscribe(...listeners: Subscription<T>[]): this

Subscribe to the event.

subscribeOnce(...listeners: Subscription<T>[]): this

Subscribe to the event once.

unsubscribe(...listeners: Subscription<T>[]): this

Unsubscribe to the event.

Async iterator.