mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Download Selected button, Various small improvements
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user