Options
All
  • Public
  • Public/Protected
  • All
Menu

A queue.

Type Parameters

  • T = never

    The type of method names to be replaced by queued versions.

Hierarchy

  • Queue

Index

Constructors

  • new Queue<T>(options?: QueueOptions): Queue<T>
  • Construct a new Queue.

    Type Parameters

    • T = never

    Parameters

    • Optional options: QueueOptions

      Queue configuration.

    Returns Queue<T>

Properties

_extended: any
_flushIfNeeded: any

Check whether the queue needs to be flushed.

_queue: any
_timeout: any
delay: null | number

Delay in milliseconds. If defined the queue will be periodically flushed.

max: number

Maximum number of entries in the queue before it will be flushed.

Methods

  • destroy(): void
  • Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object.

    Returns void

  • flush(): void
  • Flush all queued calls

    Returns void

  • queue(entry: QueueCallEntry): void
  • Queue a call.

    Parameters

    • entry: QueueCallEntry

      The function or entry to be queued.

    Returns void

  • replace<M>(object: Record<M, (() => void)>, method: M): void
  • Replace a method on an object with a queued version.

    Type Parameters

    • M extends string

    Parameters

    • object: Record<M, (() => void)>

      Object having the method.

    • method: M

      The method name.

    Returns void

  • setOptions(options?: QueueOptions): void
  • Update the configuration of the queue.

    Parameters

    • Optional options: QueueOptions

      Queue configuration.

    Returns void

  • extend<O, K>(object: O, options: QueueExtendOptions<K>): Queue<O>
  • Extend an object with queuing functionality. The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.

    Type Parameters

    • O extends { flush?: any }

    • K extends string

    Parameters

    • object: O

      The object to be extended.

    • options: QueueExtendOptions<K>

      Additional options.

    Returns Queue<O>

    The created queue.

Generated using TypeDoc