Members
#
items :array
#
iterations :number
Amount of iterations that have passed in the queue.
#
started :boolean
Has the queue started or not.
Methods
#
(static) additem(item)
Adds an item to the queue
Parameters:
Name |
Type |
Description |
item |
number
|
string
|
the item to be added to the queue. |
Example
<queue>.additem("hi"); // adds the value "hi" to the queue.
#
(static) clear()
Example
<queue>.clear(); // clears the items in the queue and the iterations
#
(static) first() → {any}
Outputs the first item in the queue.
Returns:
Returns the first value in the queue.
-
Type
-
any
Example
<queue>.first(); // outputs queue.items[0]
#
(static) shift()
Removes the item first in line in the queue.
Example
<queue>.shift(); // if the queue is ["hi", "bye"], the queue will be ["bye"]
#
(static) start(delay, callback)
Starts executing the callback with the item in the queue.
Parameters:
Name |
Type |
Description |
delay |
number
|
the amount of time the function waits for each item in the queue. |
callback |
requestCallback
|
calls the callback on each item in the queue. |
Example
<queue>.start(500, callback); // Starts executing the callback every 500 ms
#
(static) stop()
Stops the currently running queue.
Example
<queue>.stop(); // stops the currently running started queue
#
(static) tick(callback)
Same thing as start but only goes through the first item in the queue.
Parameters:
Name |
Type |
Description |
callback |
requestCallback
|
calls the callback item for the item in the queue. |
Example
<queue>.tick(callback); // goes through one iteration of the queue and then calls the callback function