Queue

Queue

Fast queue based on infloop/queue.js.

Constructor

new Queue(itemsopt)

Source:

Initialize the queue and offset.

Parameters:
Name Type Attributes Default Description
items Array <optional>
[]

The initial items in the queue.

Members

length

Source:

Get the length of the queue.

Methods

isEmpty() → {Boolean}

Source:

Return true if the queue is empty, false otherwise.

Returns:

Returns true, if the queue is empty, false otherwise.

Type
Boolean

add(…items) → {Queue}

Source:

Add an item to the queue.

Parameters:
Name Type Attributes Description
items * <repeatable>

The items to add to the queue.

Returns:

Returns the Queue itself for chaining.

Type
Queue

peek() → {*}

Source:

Return the item at the front of the queue without dequeuing it.

Returns:

The item at the front of the queue or undefined if the queue is empty.

Type
*

get() → {*}

Source:

Return the item at the front of the queue.

Returns:

The item at the front of the queue or undefined if it is empty.

Type
*

set(items) → {Queue}

Source:

Replace the queue with a different set of items.

Parameters:
Name Type Description
items Array

The new array of items.

Returns:

Returns the queue itself for chaining.

Type
Queue