Skip to main content
Module

x/async/event.ts>Event

🦕 Asynchronous primitive modules loosely port from Python's asyncio for Deno.
Go to Latest
class Event
import { Event } from "https://deno.land/x/async@v1.1.2/event.ts";

An event object. Not thread-safe.

An event can be used to notify multiple tasks that some event has happend.

Constructors

new
Event()

Methods

clear(): void

Clear (unset) the event.

Tasks awaiting on wait() will now block until the set() method is called again.

is_set(): boolean

Return true if the event is set.

set(): void

Set the event.

All tasks waiting for event to be set will be immediately awakened.

wait(): Promise<true>

Wait until the event is set.

If the event is set, return true immediately. Otherwise block until another task calls set().