I'm trying to push objects on to array and process the array as a queue. Nothing is currently removing anything from the array, and each time the acme.addToValidateQueue function is called ( several times in succession ) it always shows 1 as the array length. What am I doing wrong?
var acme = {};
acme.validateQueue = [];
acme.validateQueueLastIndex = 0;
acme.addToValidateQueue = function(fieldData,fieldName){
    var queueItem = {
        index : acme.validateQueueLastIndex,
        fieldData : fieldData,
        fieldName : fieldName
    };
    acme.validateQueue.push(queueItem);
    acme.validateQueueLastIndex++;
    console.log(acme.validateQueue.length); // shows 1 everytime the queue is called.
    if(acme.validateQueue.length === 1){
        acme.processValidateQueue();
    };
}
acme.processValidateQueue = function(){
    if(acme.validateQueue.length){
        acme.validate_field(acme.validateQueue.shift());
    }
}
 
    