Pause, cancel & resume backup media download

This commit is contained in:
trevor-signal 2024-09-16 15:38:12 -04:00 committed by GitHub
parent 65539b1419
commit 028a3f3ef0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 958 additions and 141 deletions

View file

@ -57,3 +57,23 @@ export function safeParseBigint(
}
return BigInt(value);
}
export function roundFractionForProgressBar(fractionComplete: number): number {
if (fractionComplete <= 0) {
return 0;
}
if (fractionComplete >= 1) {
return 1;
}
if (fractionComplete <= 0.01) {
return 0.01;
}
if (fractionComplete >= 0.99) {
return 0.99;
}
return Math.round(fractionComplete * 100) / 100;
}