32 lines
745 B
JavaScript
32 lines
745 B
JavaScript
import { app, BrowserWindow } from 'electron';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
width: 800,
|
|
height: 600,
|
|
webPreferences: {
|
|
preload: path.join(__dirname, 'preload.js')
|
|
}
|
|
});
|
|
|
|
// win.loadURL('http://localhost:5173'); // Standardport für Vite
|
|
win.loadFile(path.join(__dirname, 'build', 'index.html'));
|
|
}
|
|
|
|
app.disableHardwareAcceleration();
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
});
|
|
});
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') app.quit();
|
|
});
|