🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@esfx/async-waitqueue

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esfx/async-waitqueue

Provides 'WaitQueue', an async coordination primitive used to queue and resolve promises.

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

@esfx/async-waitqueue

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

Overview

  • Installation
  • Usage
  • API

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.

FAQs

Package last updated on 20 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts