T-013: Download-Manager — Queue mit Bytes-Fortschritt-Events, Abbruch, Wiederaufnahme per Manifest nach Neustart, UI: Laden/Abbrechen auf Cards
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
|
||||
export interface AuthStatus {
|
||||
logged_in: boolean
|
||||
@ -23,3 +24,16 @@ export const authStatus = () => invoke<AuthStatus>('auth_status')
|
||||
export const startLogin = () => invoke<boolean>('start_login')
|
||||
export const startDecrypt = () => invoke<boolean>('start_decrypt')
|
||||
export const getLibrary = () => invoke<Book[]>('get_library')
|
||||
|
||||
export interface DlItem {
|
||||
asin: string
|
||||
status: 'queued' | 'running' | 'done' | 'failed' | 'cancelled'
|
||||
bytes: number
|
||||
msg: string
|
||||
}
|
||||
|
||||
export const downloadList = () => invoke<DlItem[]>('download_list')
|
||||
export const downloadEnqueue = (asin: string) => invoke<DlItem>('download_enqueue', { asin })
|
||||
export const downloadCancel = (asin: string) => invoke<DlItem>('download_cancel', { asin })
|
||||
export const onDownloadUpdate = (cb: (it: DlItem) => void) =>
|
||||
listen<DlItem>('download-update', (ev) => cb(ev.payload))
|
||||
|
||||
Reference in New Issue
Block a user