Members
length
Returns the current length of the queue
Methods
clear()
Soft clear - does not reset capacity.
get(index) → {*}
Alias for peekAt()
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
Returns:
- Type
- *
isEmpty() → {boolean}
Returns true or false whether the list is empty.
Returns:
- Type
- boolean
peek() → {*}
Returns the first item in the list without removing it.
Returns:
- Type
- *
peekAt(index) → {*}
Returns the item at the specified index from the list.
0 is the first element, 1 is the second, and so on...
Elements at negative values are that many from the end: -1 is one before the end
(the last element), -2 is two before the end (one before last), etc.
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
Returns:
- Type
- *
peekBack()
Returns the item that is at the back of the queue without removing it.
Uses peekAt(-1)
peekFront() → {*}
Alias for peek()
Returns:
- Type
- *
pop() → {*}
Remove and return the last item on the list.
Returns undefined if the list is empty.
Returns:
- Type
- *
push(item)
Add an item to the bottom of the list.
Parameters:
Name | Type | Description |
---|---|---|
item |
remove(index, count) → {array}
Remove number of items from the specified index from the list.
Returns array of removed items.
Returns undefined if the list is empty.
Parameters:
Name | Type | Description |
---|---|---|
index |
||
count |
Returns:
- Type
- array
removeOne(index) → {*}
Remove and return the item at the specified index from the list.
Returns undefined if the list is empty.
Parameters:
Name | Type | Description |
---|---|---|
index |
Returns:
- Type
- *
shift() → {*}
Remove and return the first item on the list,
Returns undefined if the list is empty.
Returns:
- Type
- *
size() → {number}
Return the number of items on the list, or 0 if empty.
Returns:
- Type
- number
splice(index, count, …elementsopt) → {array}
Native splice implementation.
Remove number of items from the specified index from the list and/or add new elements.
Returns array of removed items or empty array if count == 0.
Returns undefined if the list is empty.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
|||
count |
|||
elements |
* |
<optional> <repeatable> |
Returns:
- Type
- array
toArray() → {Array}
Returns an array of all queue items.
Returns:
- Type
- Array
unshift(item)
Add an item at the beginning of the list.
Parameters:
Name | Type | Description |
---|---|---|
item |