-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.cjs
36 lines (31 loc) · 1.03 KB
/
main.cjs
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
// eslint-disable-next-line @typescript-eslint/no-var-requires,no-undef
const { app, BrowserWindow, ipcMain } = require("electron");
// eslint-disable-next-line @typescript-eslint/no-var-requires,no-undef
const path = require("path");
let mainWindow, logWindow;
app.whenReady().then(() => {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// eslint-disable-next-line no-undef
preload: path.join(__dirname, "preload.cjs"), // Utilisation du preload
},
});
mainWindow.loadURL("http://localhost:5173");
logWindow = new BrowserWindow({
width: 600,
height: 400,
webPreferences: {
// eslint-disable-next-line no-undef
preload: path.join(__dirname, "preload.cjs"), // Même preload pour la fenêtre de logs
},
});
logWindow.loadFile("logs.html");
});
// Gérer les logs
ipcMain.on("log-message", (_, log) => {
if (logWindow) {
logWindow.webContents.send("update-logs", log);
}
});