Download Selected button, Various small improvements

This commit is contained in:
Geomitron
2020-02-11 23:52:22 -05:00
parent db083d573a
commit 7d4d339018
17 changed files with 192 additions and 58 deletions

View File

@@ -41,7 +41,15 @@ export class DownloadService {
}
onDownloadUpdated(callback: (download: DownloadProgress) => void) {
this.downloadUpdatedEmitter.subscribe(_.throttle(callback, 30))
const debouncedCallback = _.throttle(callback, 30)
this.downloadUpdatedEmitter.subscribe((download: DownloadProgress) => {
if (this.downloads.findIndex(oldDownload => oldDownload.versionID == download.versionID) == -1) {
// If this is a new download item, don't call debouncedCallback; it may miss adding new versions to the list
callback(download)
} else {
debouncedCallback(download)
}
})
}
cancelDownload(versionID: number) {