界面优化,提高颜值方案
This commit is contained in:
@@ -360,6 +360,11 @@ ipcMain.on('myreader:allow-close', (event) => {
|
||||
win.close()
|
||||
})
|
||||
|
||||
ipcMain.handle('myreader:set-menu-visible', (_evt, visible: boolean): void => {
|
||||
const menu = visible ? buildMenu() : null
|
||||
Menu.setApplicationMenu(menu)
|
||||
})
|
||||
|
||||
let pendingOpenPaths: string[] = []
|
||||
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface MyReaderApi {
|
||||
deleteFile: (filePath: string) => Promise<void>
|
||||
renamePath: (oldPath: string, newName: string) => Promise<{ newPath: string }>
|
||||
allowClose: () => void
|
||||
setMenuVisible: (visible: boolean) => Promise<void>
|
||||
onRequestClose: (handler: () => void) => () => void
|
||||
onMenuAction: (handler: (action: string) => void) => () => void
|
||||
onOpenFiles: (handler: (paths: string[]) => void) => () => void
|
||||
@@ -59,6 +60,7 @@ const api: MyReaderApi = {
|
||||
allowClose: () => {
|
||||
ipcRenderer.send('myreader:allow-close')
|
||||
},
|
||||
setMenuVisible: (visible: boolean) => ipcRenderer.invoke('myreader:set-menu-visible', visible),
|
||||
onRequestClose: (handler: () => void) => {
|
||||
const listener = (): void => {
|
||||
handler()
|
||||
|
||||
Reference in New Issue
Block a user