update download + apply flow
This commit is contained in:
@@ -56,6 +56,12 @@ export type UpdateInfo = {
|
||||
current_version: string
|
||||
release_url: string
|
||||
body: string
|
||||
download_url: string | null
|
||||
}
|
||||
|
||||
export type UpdateDownloadProgress = {
|
||||
downloaded: number
|
||||
total: number | null
|
||||
}
|
||||
|
||||
export type CaptureRect = {
|
||||
@@ -132,6 +138,15 @@ export const api = {
|
||||
listen<UpdateInfo>("update-available", (e) => handler(e.payload)),
|
||||
onHotkey: (handler: (kind: "start" | "stop" | "pause") => void): Promise<UnlistenFn> =>
|
||||
listen<"start" | "stop" | "pause">("hotkey", (e) => handler(e.payload)),
|
||||
downloadUpdate: (url: string) => invoke<void>("download_update", { url }),
|
||||
applyUpdate: () => invoke<void>("apply_update"),
|
||||
pendingUpdate: () => invoke<boolean>("pending_update"),
|
||||
onUpdateDownloadProgress: (
|
||||
handler: (p: UpdateDownloadProgress) => void,
|
||||
): Promise<UnlistenFn> =>
|
||||
listen<UpdateDownloadProgress>("update-download-progress", (e) =>
|
||||
handler(e.payload),
|
||||
),
|
||||
}
|
||||
|
||||
export function formatBytes(n: number): string {
|
||||
|
||||
Reference in New Issue
Block a user