events work in electron IPC

This commit is contained in:
Jan Prochazka
2021-12-25 10:52:48 +01:00
parent 6dcbb5e308
commit 185cfab5d8
13 changed files with 68 additions and 40 deletions

View File

@@ -90,7 +90,7 @@
},
"homepage": "./",
"scripts": {
"start": "cross-env ELECTRON_START_URL=http://localhost:5000 ELECTRON_DEBUG=1 DEVMODE=1 electron .",
"start": "cross-env ELECTRON_START_URL=http://localhost:5000 DEVMODE=1 electron .",
"start:local": "cross-env electron .",
"dist": "electron-builder",
"build": "cd ../packages/api && yarn build && cd ../web && yarn build && cd ../../app && yarn dist",

View File

@@ -221,11 +221,14 @@ function createWindow() {
}
}
global.API_PACKAGE = process.env.DEVMODE ? '../packages/api/src/index' : '../packages/api/dist/bundle.js';
const api = require(path.join(
__dirname,
process.env.ELECTRON_DEBUG ? '../../packages/api' : '../packages/api/dist/bundle.js'
process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js'
));
api.getMainModule().useAllControllers(null, electron);
const main = api.getMainModule();
main.initializeElectronSender(mainWindow.webContents);
main.useAllControllers(null, electron);
loadMainWindow();
@@ -267,7 +270,9 @@ function createWindow() {
}
function onAppReady() {
autoUpdater.checkForUpdatesAndNotify();
if (!process.env.DEVMODE) {
autoUpdater.checkForUpdatesAndNotify();
}
createWindow();
}