I have an click event handler that dequeues a function if one is available. I made a loop to wait for the queue. I thought this would work but on one of my machines it results in a busy wait and freezes everything. I'm confused about why this is a problem. The goal is to wait for the queue to be non-empty. Can anyone help? Thanks
function handleViewClick(event){
clickEvent = event; // make event details available to requestReport on body-foo Q
var body = $("body");
while ( 0 == body.queue("foo").length )
setTimeout(function(){
handleViewClick(event);
},
1000);
body.dequeue("foo"); // analyze and report on click.
}