<progress id="user-progress" value="0" max="100"></progress>
<script>
function userProgress(time) {
var start = 0;
var time = Math.round(time * 1000 / 100);
var progressElement = document.getElementById('user-progress');
return new Promise(function (resolve) {
var intervalId = setInterval(function() {
if (start++ > 100) {
clearInterval(intervalId);
resolve();
} else {
progressElement.value = start;
}
}, time);
});
}
userProgress(3).then(function () {
return userProgress(5);
}).then(function () {
return userProgress(9);
});
</script>