mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Initial settings, download UI, various bugfixes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Component, ChangeDetectorRef } from '@angular/core'
|
||||
import { Download } from '../../../../../electron/shared/interfaces/download.interface'
|
||||
import { DownloadService } from '../../../../core/services/download.service'
|
||||
import * as _ from 'underscore'
|
||||
|
||||
@Component({
|
||||
selector: 'app-downloads-modal',
|
||||
templateUrl: './downloads-modal.component.html',
|
||||
styleUrls: ['./downloads-modal.component.scss']
|
||||
})
|
||||
export class DownloadsModalComponent {
|
||||
|
||||
downloads: Download[] = []
|
||||
|
||||
constructor(downloadService: DownloadService, private ref: ChangeDetectorRef) {
|
||||
const detectChanges = _.throttle(() => this.ref.detectChanges(), 30)
|
||||
downloadService.onDownloadUpdated(download => {
|
||||
const index = this.downloads.findIndex(thisDownload => thisDownload.versionID == download.versionID)
|
||||
if (index == -1) {
|
||||
this.downloads.push(download)
|
||||
} else {
|
||||
this.downloads[index] = download
|
||||
}
|
||||
detectChanges()
|
||||
})
|
||||
}
|
||||
|
||||
trackByVersionID(_index: number, item: Download) {
|
||||
return item.versionID
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user