feat: 退出应用时自动释放模型显存
This commit is contained in:
@@ -165,4 +165,6 @@ app.on('window-all-closed', () => {
|
||||
|
||||
app.on('before-quit', () => {
|
||||
isQuitting = true;
|
||||
// 通知渲染进程释放显存
|
||||
mainWindow?.webContents.send('app-quit');
|
||||
});
|
||||
|
||||
@@ -33,6 +33,9 @@ contextBridge.exposeInMainWorld('metonaDesktop', {
|
||||
onTrayAction: (callback: (action: string) => void) => {
|
||||
ipcRenderer.on('tray-action', (_: unknown, action: string) => callback(action));
|
||||
},
|
||||
onAppQuit: (callback: () => void) => {
|
||||
ipcRenderer.on('app-quit', () => callback());
|
||||
},
|
||||
removeAllListeners: (channel: string) => {
|
||||
ipcRenderer.removeAllListeners(channel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user