A bucket.

Constructors

  • Parameters

    • tokenLimit: number
    • interval: number
    • Optionaloptions: {
          latencyRef?: {
              latency: number;
          };
          reservedTokens?: number;
      }
      • OptionallatencyRef?: {
            latency: number;
        }
        • latency: number
      • OptionalreservedTokens?: number

    Returns Bucket

Properties

interval: number
lastReset: number
lastSend: number
latencyRef: {
    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