-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
40 lines (30 loc) · 1.01 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path');
const createWindow = () => {
const win = new BrowserWindow({
width: 300,
height: 400,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
}
})
win.loadFile('dist/index.html')
// win.webContents.openDevTools();
}
app.whenReady().then(() => {
createWindow()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
})
ipcMain.on('open-single-box', (_, boxId) => {
const singleBoxWindow = new BrowserWindow({
width: 800, // Set desired width for the new window
height: 600, // Set desired height for the new window
});
// Load the same HTML file but use a hash or query param to differentiate
singleBoxWindow.loadFile('dist/index.html', { hash: `box/${boxId}` });
singleBoxWindow.webContents.openDevTools();
})