Adding event handler for config request that only happens once on load
This commit is contained in:
parent
fa70f9efdd
commit
6e0919e32c
@ -1,15 +1,12 @@
|
|||||||
const { ArgumentParser } = require('argparse')
|
const { ipcMain } = require('electron')
|
||||||
const { app, BrowserWindow } = require('electron')
|
const { app, BrowserWindow } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const cfg = require('./js/config.js')
|
const cfg = require('./src/config.js')
|
||||||
|
|
||||||
|
|
||||||
let win
|
let win
|
||||||
const config = cfg.get_config(cfg.load_parser())
|
const config = cfg.get_config(cfg.load_parser())
|
||||||
console.log('Config: ', config)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function createWin() {
|
function createWin() {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
@ -19,7 +16,7 @@ function createWin() {
|
|||||||
minHeight: 480,
|
minHeight: 480,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
preload: path.join(__dirname + 'preload.js')
|
preload: path.join(__dirname + '/preload.js')
|
||||||
},
|
},
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
})
|
})
|
||||||
@ -51,3 +48,7 @@ app.on('activate', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// returns the config
|
||||||
|
ipcMain.on('config-request', (event, _arg) => {
|
||||||
|
event.returnValue = config
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user