fix(electron): register activate handler after app is ready (#55)
This commit is contained in:
@@ -171,7 +171,17 @@ async function initialize(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Application lifecycle
|
// Application lifecycle
|
||||||
app.whenReady().then(initialize);
|
app.whenReady().then(() => {
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
// Register activate handler AFTER app is ready to prevent
|
||||||
|
// "Cannot create BrowserWindow before app is ready" on macOS.
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
mainWindow = createWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
@@ -179,12 +189,6 @@ app.on('window-all-closed', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('activate', () => {
|
|
||||||
if (BrowserWindow.getAllWindows().length === 0) {
|
|
||||||
mainWindow = createWindow();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on('before-quit', async () => {
|
app.on('before-quit', async () => {
|
||||||
await gatewayManager.stop();
|
await gatewayManager.stop();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user