app startup fix

This commit is contained in:
Jan Prochazka 2022-04-24 22:28:04 +02:00
parent aa8854da93
commit 3a20f24f7c

View File

@ -21,6 +21,7 @@ const { settings } = require('cluster');
const configRootPath = path.join(app.getPath('userData'), 'config-root.json'); const configRootPath = path.join(app.getPath('userData'), 'config-root.json');
let initialConfig = {}; let initialConfig = {};
let apiLoaded = false; let apiLoaded = false;
let mainModule;
const isMac = () => os.platform() == 'darwin'; const isMac = () => os.platform() == 'darwin';
@ -337,9 +338,10 @@ function createWindow() {
// ); // );
const main = api.getMainModule(); const main = api.getMainModule();
main.useAllControllers(null, electron); main.useAllControllers(null, electron);
mainModule = main;
apiLoaded = true; apiLoaded = true;
} }
main.setElectronSender(mainWindow.webContents); mainModule.setElectronSender(mainWindow.webContents);
loadMainWindow(); loadMainWindow();
@ -349,7 +351,7 @@ function createWindow() {
// in an array if your app supports multi windows, this is the time // in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element. // when you should delete the corresponding element.
mainWindow = null; mainWindow = null;
main.setElectronSender(null); mainModule.setElectronSender(null);
}); });
} }