bug修复

This commit is contained in:
2026-05-18 14:13:16 +08:00
parent c0d71e57ae
commit 1e53162f0d
4 changed files with 53 additions and 3 deletions
+10
View File
@@ -25,6 +25,7 @@ export interface MyReaderApi {
allowClose: () => void
onRequestClose: (handler: () => void) => () => void
onMenuAction: (handler: (action: string) => void) => () => void
onOpenFiles: (handler: (paths: string[]) => void) => () => void
}
const api: MyReaderApi = {
@@ -64,6 +65,15 @@ const api: MyReaderApi = {
return () => {
ipcRenderer.removeListener('myreader:menu', listener)
}
},
onOpenFiles: (handler: (paths: string[]) => void) => {
const listener = (_e: unknown, paths: string[]): void => {
handler(paths)
}
ipcRenderer.on('myreader:open-files', listener)
return () => {
ipcRenderer.removeListener('myreader:open-files', listener)
}
}
}