Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove useless code and add comments #16

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading