Class Bucket

A bucket.

Constructors

  • Parameters

    • tokenLimit: number
    • interval: number
    • Optional options: {
          latencyRef?: {
              latency: number;
          };
          reservedTokens?: number;
      }
      • Optional latencyRef?: {
            latency: number;
        }
        • latency: number
      • Optional reservedTokens?: number

    Returns Bucket

Properties

interval: number
lastReset: number
lastSend: number
latencyRef: {
    latency: number;
}

Type declaration

  • latency: number
reservedTokens: number
timeout: null | Timeout
tokenLimit: number
tokens: number

Methods

  • Add an item to the queue.

    Parameters

    • func: (() => void)

      The function to queue.

        • (): void
        • Returns void

    • priority: boolean = false

      If true, the item will be added to the front of the queue.

    Returns void