API (v2.0.0) - Giro3D
    Preparing search index...

    A generic priority queue that ensures that the same request cannot be added twice in the queue.

    Hierarchy

    Implements

    Index

    Constructors

    • Parameters

      • options: { maxConcurrentRequests?: number } = {}

        Options.

        • OptionalmaxConcurrentRequests?: number

          The maximum number of concurrent requests.

      Returns RequestQueue

    Accessors

    • get loading(): boolean

      Gets whether the object is currently performing an asynchronous operation.

      Returns boolean

    • get progress(): number

      Returns the percentage of progress, in normalized value (i.e in the [0, 1] range), of the asynchronous operations that are scheduled to run on this object. 1 means that all operations have finished.

      Returns number

    Methods

    • Enqueues a request. If a request with the same id is currently in the queue, then returns the promise associated with the existing request.

      Type Parameters

      • T

      Parameters

      • options: {
            id: string;
            priority?: number;
            request: () => Promise<T>;
            shouldExecute?: () => boolean;
            signal?: AbortSignal;
        }

        Options.

        • id: string

          The unique identifier of this request.

        • Optionalpriority?: number

          The priority of this request.

        • request: () => Promise<T>

          The request.

        • OptionalshouldExecute?: () => boolean

          The optional predicate used to discard a task: if the function returns false, the task is not executed.

        • Optionalsignal?: AbortSignal

          The abort signal.

      Returns Promise<T>

      A promise that resolves when the requested is completed.

      AbortError if the request is aborted before being started (either because the AbortSignal became aborted, or if the shouldExecute() function returned true.