Fix speed is null

This commit is contained in:
2024-05-25 20:45:15 +08:00
parent 931824d3a9
commit df04cfa93e

View File

@@ -157,7 +157,7 @@ class DownloadManager {
const now = Date.now();
this.#progress.downloaded_bytes += num;
d.downloaded = downloaded;
d.speed = num / (now - d.last_updated);
d.speed = now == d.last_updated ? 0 : num / (now - d.last_updated);
d.last_updated = now;
}
this.#sendEvent();