Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 3x 3x 1x 3x 3x 3x 3x 3x | export class Progress {
private _startTime: number | null = null;
private _elapsedTime: number = 0;
private _remainingTime: number = 0;
get value(): number {
return this._remainingTime;
}
next(progress: number): void {
if (progress > 0 && this._startTime === null) {
this._startTime = Date.now();
}
Eif (progress > 0 && this._startTime !== null) {
this._elapsedTime = (Date.now() - this._startTime) / 1000; // in seconds
Eif (progress > 0) {
const speed = this._elapsedTime / progress;
this._remainingTime = speed * (1 - progress);
}
}
}
}
|