File size: 728 Bytes
f0bb158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export class ProgressBar {
    constructor(elementId) {
        this.element = document.getElementById(elementId);
        this.currentProgress = 0;
    }

    animate(targetProgress) {
        if (this.currentProgress < targetProgress) {
            this.currentProgress++;
            this.element.style.width = `${this.currentProgress}%`;
            this.element.textContent = `${this.currentProgress}%`;
            setTimeout(() => this.animate(targetProgress), 75);
        }
    }

    init(repoData) {
        const max_value = 100;
        const current_status = Math.round((repoData[repoData.length - 1].xet_repos / repoData[repoData.length - 1].hub_repos) * max_value);
        this.animate(current_status);
    }
}