Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/promise-queue

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/promise-queue

TypeScript definitions for promise-queue

  • 2.2.3
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/promise-queue

Summary

This package contains type definitions for promise-queue (https://github.com/azproduction/promise-queue).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-queue.

index.d.ts

export = PromiseQueue;

declare class PromiseQueue {
    /**
     * @param maxPendingPromises [Infinity] Number of promises that can run at once.
     * @param maxQueuedPromises [Infinity] Number of promises generators that can be in the queue at once.
     *                                     `add()` will return a rejected promise if this limit would be exceeded.
     * @param options [{}] See QueueOptions
     */
    constructor(maxPendingPromises?: number, maxQueuedPromises?: number, options?: PromiseQueue.QueueOptions);

    /**
     * Enqueue a promise generator. When the number of running promises is less than `maxPendingPromises`,
     * this function will be called and the returned promise will be held as a running promise until it
     * rejects or resolves.
     *
     * @throws If the global `Promise` is undefined and `Queue.configure` hasn't been called.
     * @param promiseGenerator A function that returns a promise when called.
     * @returns A promise that forwards the resolution/rejection of the promise returned by `promiseGenerator`,
     *          or immediately rejects if `maxQueuedPromise` is exceeded.
     */
    add<T>(promiseGenerator: () => Promise<T>): Promise<T>;

    /**
     * Returns the number of promiseGenerators waiting in queue.
     */
    getPendingLength(): number;

    /**
     * Returns the number of in-flight promises
     */
    getQueueLength(): number;

    /**
     * Set which promise constructor to use for the value returned by PromiseQueue#add.
     * If this isn't called, the global `Promise` constructor is used.
     * @param GlobalPromise A constructor for Promises
     */
    static configure(GlobalPromise: PromiseConstructor): void;
}

declare namespace PromiseQueue {
    interface QueueOptions {
        /**
         * Callback that is called when the queue is empty and all pending promises have resolved
         */
        onEmpty(): void;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Lachlan Stuart.

FAQs

Package last updated on 07 Nov 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc