Class LimiterStateHandlerAbstract

A limiter state handler is a class that manages the state of a limiter, including the queue of tasks, the concurrency, and the limiter options.

Hierarchy (View Summary)

  • EventEmitter

Constructors

Accessors

  • get pending(): number
  • Returns the number of pending jobs

    Returns number

  • get size(): number
  • Returns the number of jobs in the queue

    Returns number

Methods

  • Register an event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      Done event listener

    Returns this

  • Register an event listener over the refill event, which is emitted when queue bucket is refilled

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      Refill event listener

    Returns this

  • Register an event listener over the seed event, which is emitted when queue is empty and a new task is added

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to add

    Returns this

  • Clears the queue

    Returns void

  • Removes the specified listener from the listener array for the done event.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      The listener function to remove

    Returns this

  • Removes the specified listener from the listener array for the refill event.

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      The listener function to remove

    Returns this

  • Removes the specified listener from the listener array for the seed event.

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to remove

    Returns this

  • Register an event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      Done event listener

    Returns this

  • Register an event listener over the refill event, which is emitted when queue bucket is refilled

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      Refill event listener

    Returns this

  • Register an event listener over the seed event, which is emitted when queue is empty and a new task is added

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to add

    Returns this

  • Registers a one-time event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      Done event listener

    Returns this

  • Registers a one-time event listener over the refill event, which is emitted when queue bucket is refilled

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      Refill event listener

    Returns this

  • Registers a one-time event listener over the seed event, which is emitted when queue is empty and a new task is added

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to add

    Returns this

  • Registers a event listener over the done event, at the beginning of the listeners array, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      Done event listener

    Returns this

  • Registers a event listener over the refill event, at the beginning of the listeners array, which is emitted when queue bucket is refilled

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      Refill event listener

    Returns this

  • Registers a event listener over the seed event, at the beginning of the listeners array, which is emitted when queue is empty and a new task is added

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to add

    Returns this

  • Registers a one-time event listener over the done event, at the beginning of the listeners array, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      Done event listener

    Returns this

  • Registers a one-time event listener over the refill event, at the beginning of the listeners array, which is emitted when queue bucket is refilled

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      Refill event listener

    Returns this

  • Registers a one-time event listener over the seed event, at the beginning of the listeners array, which is emitted when queue is empty and a new task is added

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to add

    Returns this

  • Removes all listeners, or those of the specified event.

    Parameters

    • Optionalevent: "done"

      done event

    Returns this

  • Removes all listeners, or those of the specified event.

    Parameters

    • Optionalevent: "refill"

      refill event

    Returns this

  • Removes all listeners, or those of the specified event.

    Parameters

    • Optionalevent: "seed"

      seed event

    Returns this

  • Removes the specified listener from the listener array for the done event.

    Parameters

    • event: string

      done event

    • listener: DoneListener

      The listener function to remove

    Returns this

  • Removes the specified listener from the listener array for the refill event.

    Parameters

    • event: "refill"

      refill event

    • listener: () => void

      The listener function to remove

    Returns this

  • Removes the specified listener from the listener array for the seed event.

    Parameters

    • event: "seed"

      seed event

    • listener: () => void

      The listener function to remove

    Returns this