45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
/// <reference types="vite/client" />
|
|
|
|
/**
|
|
* Electron API 类型声明
|
|
* 对应 preload 中暴露的 API
|
|
*/
|
|
interface FileOperationResult {
|
|
success: boolean
|
|
message: string
|
|
path?: string | null
|
|
content?: string | null
|
|
canceled?: boolean
|
|
}
|
|
|
|
interface GitOperationResult {
|
|
success: boolean
|
|
message: string
|
|
stdout?: string
|
|
}
|
|
|
|
interface ElectronAPI {
|
|
file: {
|
|
save: (content: string, filename?: string) => Promise<FileOperationResult>
|
|
read: (filename?: string) => Promise<FileOperationResult>
|
|
openDirectory: () => Promise<FileOperationResult>
|
|
}
|
|
git: {
|
|
clone: (repoUrl: string, targetDir: string) => Promise<GitOperationResult>
|
|
onProgress: (callback: (data: { repoUrl: string; raw: string }) => void) => void
|
|
removeListener: () => void
|
|
}
|
|
settings: {
|
|
get: (key?: string) => Promise<SettingsOperationResult>
|
|
save: (key: string, value: unknown) => Promise<SettingsOperationResult>
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
electronAPI: ElectronAPI
|
|
}
|
|
}
|
|
|
|
export { }
|