renderer.js
ipcRenderer.sendSync('setGlobal', 'globalVarName').varInner.varInner2 = 'result';
main.js
global.globalVarName = {
varInner: {
varInner2: ''
},
iWontChange: 'hi'
};
ipcMain.on('setGlobal', (event, arg) => {
console.log(arg) // should print "result"
// what goes here?
})
console.log(varInner2) // should print "result"
Is something like this possible, namely setting the varInner2
of globalVarName
in this manner? Secondly, is there a way to optimize this so we wouldn't have to rewrite this process for every global variable (i.e. some way to do this with dynamic variable names)?
I appreciate any ideas or solutions, sorry if this is a common sense question.