1234567891011121314151617181920212223242526272829303132 |
- const { app, BrowserWindow, Menu, ipcMain } = require('electron');
- const path = require('path');
- function createWindow() {
- Menu.setApplicationMenu(null);
- const win = new BrowserWindow({
- width: 1200,
- height: 800,
- fullscreen: true,
- webPreferences: {
- preload: path.resolve(__dirname, './preload.js')
- },
- icon: path.resolve(__dirname, './icons/icon.ico')
- });
- win.loadURL(process.env.VITE_DEV_SERVER_URL || path.resolve(__dirname, '../dist/index.html'));
- if (process.env.NODE_ENV === 'development')
- win.webContents.openDevTools();
- ipcMain.on('close-window', () => {
- win.close();
- });
- ipcMain.on('toggle-fullscreen', () => {
- win.setFullScreen(!win.isFullScreen());
- });
- ipcMain.on('toggle-devtools', () => {
- win.webContents.toggleDevTools();
- });
- }
- app.whenReady().then(createWindow);
|