I'm trying to make an event driven while loop in javascript. Essentially it iterates through an array of values and makes a query during each iteration. Then, based on the result of the query it should either keep looping or stop and do something.
I realize that you can't have callbacks in a while loop so I'm confused on how to even implement such a thing. Nested functions repeat themselves and that's not ideal.
my loop code:
var done = false;
while(!done){
bridgeCheckRooms(send,function(reply){ //callback
console.log(tagArray[count]);
console.log(reply);
if(reply.success){
done = true;
} else {
count--;
}
});
}