On clicking on Continue to payment I don’t get data in checkout.tax_lines object immediately

on clicking on Continue to payment I don’t get data in checkout.tax_lines immediately from Shopify. To handle this I have applied the 3-sec timeout but it’s not working in every case, Set Interval will work but it can create a performance issue, also on changing country it picking previous country tax percentage due to the same reason, I need to calculate the total tax percentage on continuing to the payment.

function getLoopData(tax_label){
if(‘{{checkout.tax_lines}}’){
tax_label.innerHTML=Taxes ( {%assign final_tax_value = 0%} {%for singleobject in checkout.tax_lines %} {% assign index = forloop.index | minus:1 %} {%assign final_tax_value = final_tax_value | plus: checkout.tax_lines[index].rate_percentage %} {%endfor%} {{final_tax_value}}%);
}
}

In the above function I am calculating the total tax percentage ,but it’s not going inside if condition as i am not getting {{checkout.tax_lines}} immediately.