mirror of
https://hub.gitmirror.com/https://github.com/ExamAware/ExamShowboard-Legacy.git
synced 2025-04-29 13:46:32 +00:00

修复了`prog:loadjson`事件处理函数中的一个错误,该错误涉及调用`fileUtils.readFile`方法时缺少结束分号。此更改确保了代码的一致性和正确性,符合语言的语法规则。
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { ipcMain, BrowserWindow, app } from 'electron';
|
|
import windowManager from '../utils/windowManager';
|
|
import WindowName from '../types/WindowName';
|
|
import { fileUtils } from '../utils/fileManager';
|
|
|
|
const ipcWindow = {
|
|
register() {
|
|
ipcMain.on('window:minimize', (event) => {
|
|
const window = BrowserWindow.fromId(event.sender.id);
|
|
if (window) {
|
|
// 添加此行检查window是否为null
|
|
window.minimize();
|
|
} else {
|
|
console.error('Failed to minimize: Window not found');
|
|
}
|
|
});
|
|
ipcMain.on('prog:exit', (event) => {
|
|
windowManager.destroyAllWindows();
|
|
app.quit();
|
|
});
|
|
ipcMain.on('window:open', (event, name: WindowName) => {
|
|
return windowManager.createByName(name);
|
|
});
|
|
|
|
ipcMain.on('prog:loadjson', async (event) => {
|
|
const window = BrowserWindow.fromId(event.sender.id);
|
|
const file = await fileUtils.readFile();
|
|
await window.webContents.send('common:openFile', file);
|
|
});
|
|
}
|
|
};
|
|
|
|
export default ipcWindow;
|