Loop with setInterval until condition is true.