JSFiddle - React, Tailwind, and code Playground

HTML

<div id="progressbar"></div>

JavaScript

prog_bar = $("#progressbar");
var i = 0;
//instead of setInterval you would call it from your "other code" you refered to
var refreshInterval = setInterval(update_progress_bar, 5);

function update_progress_bar() {
    if (i % 10 == 0) {
        prog_bar.progressbar({
            value: (i / 1000) * 100
        });
    }
    i++;
    if (i == 10000) {
        clearInterval(refreshInterval);
    };
}