More download bugfixes

This commit is contained in:
Geomitron
2020-05-10 15:46:11 -04:00
parent a81fddea3b
commit 8a4620d771
10 changed files with 74 additions and 42 deletions

View File

@@ -1,7 +1,6 @@
import { Injectable, EventEmitter } from '@angular/core'
import { ElectronService } from './electron.service'
import { NewDownload, DownloadProgress } from '../../../electron/shared/interfaces/download.interface'
import * as _ from 'underscore'
@Injectable({
providedIn: 'root'
@@ -46,14 +45,7 @@ export class DownloadService {
}
onDownloadUpdated(callback: (download: DownloadProgress) => void) {
const debouncedCallback = _.throttle(callback, 30, { trailing: false })
this.downloadUpdatedEmitter.subscribe((download: DownloadProgress) => {
if (download.type == 'fastUpdate') { // 'good' updates can happen so frequently that the UI doesn't update correctly
debouncedCallback(download)
} else {
callback(download)
}
})
this.downloadUpdatedEmitter.subscribe(callback)
}
cancelDownload(versionID: number) {