refactor: split preload api by domain

This commit is contained in:
Misaka
2026-03-21 10:49:13 +08:00
parent 26c05f3726
commit ed65312fff
13 changed files with 284 additions and 242 deletions

11
src/preload/api/file.ts Normal file
View File

@@ -0,0 +1,11 @@
import { IPC_CHANNELS } from '../../shared/ipc-channels'
import { invokeIpc } from '../lib/ipc'
export const fileApi = {
readFile: (filePath: string) => invokeIpc(IPC_CHANNELS.FILE_READ, filePath),
writeFile: (filePath: string, content: string) =>
invokeIpc(IPC_CHANNELS.FILE_WRITE, filePath, content),
fileExists: (filePath: string) => invokeIpc(IPC_CHANNELS.FILE_EXISTS, filePath),
listFiles: (dirPath: string) => invokeIpc(IPC_CHANNELS.FILE_LIST, dirPath),
openPath: (filePath: string) => invokeIpc(IPC_CHANNELS.FILE_OPEN_PATH, filePath)
} as const