Fixed a bug where config data wasn't displayed reliably
This commit is contained in:
1 parent
fb7381fa6c
commit
8d8ccb064e
1 file changed
+12
-4
+12
-4
@@ -23,6 +23,12 @@ let configPath;
|
||||
let configWindow;
|
||||
let saveCallback;
|
||||
|
||||
function sendConfig() {
|
||||
if (configWindow && !configWindow.isDestroyed()) {
|
||||
configWindow.webContents.send('update-config', exports.data);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Public fields
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -134,7 +140,6 @@ exports.showWindow = (parent, callback) => {
|
||||
|
||||
// create lazily
|
||||
if (configWindow == undefined) {
|
||||
console.log("create windows");
|
||||
saveCallback = callback;
|
||||
|
||||
configWindow = new BrowserWindow({
|
||||
@@ -157,6 +162,9 @@ exports.showWindow = (parent, callback) => {
|
||||
configWindow.hide();
|
||||
});
|
||||
|
||||
// update text field values
|
||||
configWindow.webContents.on('did-finish-load', sendConfig);
|
||||
|
||||
ipcMain.on('save-config', (event, configData) => {
|
||||
configWindow.hide();
|
||||
this.save(configData);
|
||||
@@ -167,10 +175,10 @@ exports.showWindow = (parent, callback) => {
|
||||
});
|
||||
|
||||
configWindow.loadFile('./html/config.html');
|
||||
}
|
||||
|
||||
} else {
|
||||
// update text field values
|
||||
configWindow.webContents.send('update-config', this.data);
|
||||
sendConfig();
|
||||
}
|
||||
|
||||
// show window
|
||||
configWindow.show();
|
||||
|
||||
Reference in new issue
Block a user