Constructor
new Queue(itemsopt)
Initialize the queue and offset.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
items |
Array |
<optional> |
[]
|
The initial items in the queue. |
Members
length
Get the length of the queue.
Methods
isEmpty() → {Boolean}
Return true if the queue is empty, false otherwise.
Returns:
Returns true, if the queue is empty, false otherwise.
- Type
- Boolean
add(…items) → {Queue}
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() → {*}
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() → {*}
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}
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