mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 15:44:35 +01:00
begin download handler
This commit is contained in:
@@ -1,5 +1,28 @@
|
||||
|
||||
import { invoke } from '@tauri-apps/api/tauri'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
|
||||
export default class DownloadHandler {
|
||||
downloads: Array<string>
|
||||
|
||||
// Pass tauri invoke function
|
||||
constructor() {
|
||||
console.log('AAAAAAAAAAAAAAAAAAAAA')
|
||||
this.downloads = []
|
||||
|
||||
listen('download_progress', (...payload) => {
|
||||
console.log(payload)
|
||||
})
|
||||
|
||||
listen('download_finished', (...payload) => {
|
||||
console.log(payload)
|
||||
})
|
||||
}
|
||||
|
||||
addDownload(url: string, path: string) {
|
||||
// Begin download from rust backend
|
||||
invoke('download_file', { url, path })
|
||||
|
||||
// Register event handler
|
||||
this.downloads.push(path)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user