fix: déplacer handlers IPC dans app.whenReady()
Les handlers ipcMain.handle() doivent être définis après app.whenReady() sinon ipcMain est undefined Résout: TypeError: Cannot read properties of undefined (reading 'handle')
This commit is contained in:
+4
-4
@@ -272,8 +272,10 @@ async function pingServer() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== IPC Handlers ==========
|
// ========== App Lifecycle ==========
|
||||||
|
|
||||||
|
app.whenReady().then(async () => {
|
||||||
|
// Setup IPC Handlers (doit être après app.whenReady)
|
||||||
ipcMain.handle('server:start', async () => {
|
ipcMain.handle('server:start', async () => {
|
||||||
return await startServer();
|
return await startServer();
|
||||||
});
|
});
|
||||||
@@ -299,9 +301,7 @@ ipcMain.handle('server:ping', async () => {
|
|||||||
return await pingServer();
|
return await pingServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== App Lifecycle ==========
|
// Créer fenêtre
|
||||||
|
|
||||||
app.whenReady().then(async () => {
|
|
||||||
createWindow();
|
createWindow();
|
||||||
createTray();
|
createTray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user