Running empty while loops is a bad idea. You not only record processor cycles, but Javacript is single-threaded, so you will forever go in cycles, giving anyone no chance to change the variable.
What you can do is rewrite the table in which there are other people, depending on it, to "trigger the event itself." There are many ways to do this, but basically you just want it to call the continue function instead of blind returning. This function can be predefined or you can pass it as a parameter somewhere.
//this is just illustrative //Your actual code will be probably very different from this. function update_part(){ //do something signal_finished_part() } var parts_done = 0; function signal_finished_part(){ parts_done ++; if(parts_done >= 5){ signal_all_parts_done(); } } function signal_all_parts_done() { //do something to table A }
hugomg
source share