it
    Preparing search index...

    Class Queue<JobReturnType, JobOptions>

    Heavily influence by p-queue with the following differences:

    1. Items remain at the head of the queue while they are running so queue.size includes queue.pending items - this is so interested parties can join the results of a queue item while it is running
    2. The options for a job are stored separately to the job in order for them to be modified while they are still in the queue
    3. If a job's abort signal fires before execution begins, it is removed from the queue immediately
    4. 'success'/'failure' events are emitted instead of 'error'/'complete'

    Type Parameters

    Hierarchy

    Index

    Constructors

    Properties

    concurrency: number
    maxSize: number

    Accessors

    Methods

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • Parameters

      • type: string

      Returns number

    • The difference with .onEmpty is that .onIdle guarantees that all work from the queue has finished. .onEmpty merely signals that the queue is empty, but it could mean that some promises haven't completed yet.

      Parameters

      Returns Promise<void>

      A promise that settles when the queue becomes empty, and all promises have completed; queue.size === 0 && queue.pending === 0.

    • Parameters

      Returns Promise<void>

      A promise that settles when the queue size is less than the given limit: queue.size < limit.

      If you want to avoid having the queue grow beyond a certain size you can await queue.onSizeLessThan() before adding a new item.

      Note that this only limits the number of items waiting to start. There could still be up to concurrency jobs already running that this call does not include in its calculation.

    • Start the queue. If the autoStart parameter passed to the constructor was not false this is a no-op

      Returns void