Skip to content

Commit

Permalink
chore: remove useless code and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lgz5689 committed Sep 19, 2024
1 parent bf9bfa4 commit ac4dd04
Show file tree
Hide file tree
Showing 4 changed files with 3,779 additions and 3,193 deletions.
7 changes: 5 additions & 2 deletions electron/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export type IpcRenderToMainSyncDataMap = {
};

export interface IElectronAPI {
fileExists: (path: string) => boolean;
getPlatform: () => string;
// ipc
ipcInvoke: <T extends keyof IpcRenderToMainDataMap>(
channel: T,
...arg: unknown[]
Expand All @@ -29,6 +28,10 @@ export interface IElectronAPI {
channel: T,
...arg: unknown[]
) => IpcRenderToMainSyncDataMap[T];

// func
fileExists: (path: string) => boolean;
getPlatform: () => string;
openFile: (path: string) => Promise<string>;
showFile: (path: string) => void;
}
7 changes: 5 additions & 2 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ const ipcSendSync = <T extends IpcRenderToMainSync>(
};

const Api: IElectronAPI = {
fileExists: fs.existsSync,
getPlatform: () => process.platform,
// ipc
ipcInvoke,
ipcSendSync,

// func
fileExists: fs.existsSync,
getPlatform: () => process.platform,
openFile: shell.openPath,
showFile: shell.showItemInFolder,
};
Expand Down
Loading

0 comments on commit ac4dd04

Please sign in to comment.