BasicQueue(initialQueue, frozenCB)

This is a basic queue for managing work flows

new BasicQueue(initialQueue, frozenCB)

Create a basic queue
Parameters:
Name Type Description
initialQueue Array Initial array of values
frozenCB function Call back to execute when an op is run while queue is frozen

Members

frozen :Boolean

frozenCB :function

length :string

queue :Array

Methods

add(item) → {Boolean}

Adds one item to the end of the queue
Parameters:
Name Type Description
item * Item to be added to queue
Returns:
Boolean - Indicates if it was successful

addToBeginning(item) → {Boolean}

Add one item to the beginning of the queue
Parameters:
Name Type Description
item * Item to be added to queue
Returns:
Boolean - Indicates if it was successful

freeze()

Freezes the queue

freezeCheck() → {Boolean}

Checks if frozen and executes CB if one is provided Internal FN designed for lib use
Returns:
Boolean - Indicates if it was frozen

getAll() → {Array|Boolean}

Gets all items currently in the queue
Returns:
Array | Boolean - All items in queue or false if frozen

getIndex(index, qty) → {Array|Boolean}

Take an item out of the queue at a specific index
Parameters:
Name Type Default Description
index Number 0 The index to start at
qty Number 1 The number of records to retrieve
Returns:
Array | Boolean - Returns an array of values or false if frozen

getLast(qty) → {Array|Boolean}

Gets the last item from the queue
Parameters:
Name Type Default Description
qty Number 1 The quantity to be returned
Returns:
Array | Boolean - Returns an array of values or false if frozen

getNext(qty) → {Array|Boolean}

Gets the next items in queue
Parameters:
Name Type Default Description
qty Number 1 The quantity to be returned starting from index 0
Returns:
Array | Boolean - Returns an array of values or false if frozen

remove(item) → {Boolean}

Locates the item and removes it from the queue
Parameters:
Name Type Description
item * Must be the EXACT item (===) comparison done
Returns:
Boolean - Indicates if the item was removed or not

removeIndex(index) → {Boolean}

Remove one item based on the array index
Parameters:
Name Type Default Description
index Number 0 Index of the item to be removed
Returns:
Boolean - Indicates if the item was removed or not

unfreeze()

Unfreeze the queue