@ac-essentials/misc-util
    Preparing search index...

    Class PriorityQueue<T, P>

    A priority queue implementation.

    Type Parameters

    • T

      The type of elements in the priority queue.

    • P = number

      The type of priority associated with each element.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    capacity: number = Infinity

    The maximum number of elements the collection can hold. If the collection is unbounded, this will be Infinity.

    data: BinaryHeap<[T, P]>
    isHigherPriority: PriorityQueueIsHigherPriorityPredicate<P> = ...

    Predicate function which determine if one priority is higher than another.

    Methods

    • Inserts one or more items with their associated priorities into the priority queue.

      Parameters

      • priority: P

        The priority of the items to insert.

      • ...items: T[]

        The items to insert.

      Returns void

      If the operation would exceed the deque's capacity.

    • Same as insert, but waits for capacity if the operation would exceed it.

      Parameters

      • priority: P
      • items: Iterable<T>
      • Optionalsignal: null | AbortSignal

        Optional abort signal to cancel the operation.

      Returns Promise<void>

      IPriorityQueue.insert