Refactor initialization sequence for clarity

Move the IPC Communication initialization block before the condition checking the development environment. This change ensures that IPCs are initialized before the main window starts loading its content, which may be crucial for ensuring that all IPC handlers are set up properly regardless of the environment.
This commit is contained in:
choigawoon committed 2023-11-08 16:32:05 +09:00
1 parent 105077f068
commit 7015667fd6
1 file changed
+3 -3
+3 -3
View File
@@ -40,15 +40,15 @@ export const createMainWindow = async (mainWindow: BrowserWindow): Promise<Brows
mainWindow.setAlwaysOnTop(false) mainWindow.setAlwaysOnTop(false)
}) })
// Initialize IPC Communication
IPCs.initialize(mainWindow)
if (Constants.IS_DEV_ENV) { if (Constants.IS_DEV_ENV) {
await mainWindow.loadURL(Constants.APP_INDEX_URL_DEV) await mainWindow.loadURL(Constants.APP_INDEX_URL_DEV)
} else { } else {
await mainWindow.loadFile(Constants.APP_INDEX_URL_PROD) await mainWindow.loadFile(Constants.APP_INDEX_URL_PROD)
} }
// Initialize IPC Communication
IPCs.initialize(mainWindow)
return mainWindow return mainWindow
} }