29 lines
687 B
JavaScript
29 lines
687 B
JavaScript
const { app, BrowserWindow } = require('electron');
|
|
const path = require('path');
|
|
|
|
/**
|
|
* Creates the main application window.
|
|
* Uses a preload bridge so the renderer can stay in the safer default context.
|
|
*/
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
width: 1200,
|
|
height: 800,
|
|
backgroundColor: '#1a1a2e',
|
|
webPreferences: {
|
|
preload: path.join(__dirname, 'preload.js'),
|
|
sandbox: false,
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
},
|
|
});
|
|
|
|
win.loadFile(path.join(__dirname, 'index.html'));
|
|
}
|
|
|
|
app.whenReady().then(createWindow);
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') app.quit();
|
|
});
|