naM ,sevitcepsreP weN

    @esfx/async-waitqueue
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    @esfx/async-waitqueue

    The @esfx/async-waitqueue package provides the WaitQueue class, an async coordination primitive used to queue and resolve promises.

    Overview

    Installation

    npm i @esfx/async-waitqueue

    Usage

    import { WaitQueue } from "@esfx/async-waitqueue";
    
    async function main() {
        const queue = new WaitQueue();
    
        // Create two pending "waiters" in the queue
        const p1 = queue.wait();
        const p2 = queue.wait();
    
        // Resolve the two pending "waiters" in the queue
        queue.resolveOne(1);
        queue.resolveOne(2);
    
        await p1; // 1
        await p2; // 2
    }

    API

    You can read more about the API here.

    Keywords

    none

    Install

    npm i @esfx/async-waitqueue

    DownloadsWeekly Downloads

    209

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    48.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • rbuckton