Queue

Queue

# new Queue()

The queue system

Source:

Members

# items :array

The items in the queue.

Type:
  • array
Source:

# iterations :number

Amount of iterations that have passed in the queue.

Type:
  • number
Source:

# started :boolean

Has the queue started or not.

Type:
  • boolean
Source:

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.

Source:
Example
<queue>.additem("hi"); // adds the value "hi" to the queue.

# (static) clear()

Clears the queue.

Source:
Example
<queue>.clear(); // clears the items in the queue and the iterations

# (static) first() → {any}

Outputs the first item in the queue.

Source:
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.

Source:
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.

Source:
Example
<queue>.start(500, callback); // Starts executing the callback every 500 ms

# (static) stop()

Stops the currently running queue.

Source:
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.

Source:
Example
<queue>.tick(callback); // goes through one iteration of the queue and then calls the callback function