title: Using ipc in Electron to set global variable from renderer
body: <p>renderer.js</p>
  
  <pre><code>ipcRenderer.sendSync('setGlobal', 'globalVarName').varInner.varInner2 = 'result';
  </code></pre>
  
  <p>main.js</p>
  
  <pre><code>global.globalVarName = {
    varInner: {
      varInner2: ''
    },
    iWontChange: 'hi'
  };
  
  ipcMain.on('setGlobal', (event, arg) =&gt; {
    console.log(arg) // should print "result"
    // what goes here?
  })
  
  console.log(varInner2) // should print "result"
  </code></pre>
  
  <p>Is something like this possible, namely setting the <code>varInner2</code> of <code>globalVarName</code> 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)? </p>
  
  <p>I appreciate any ideas or solutions, sorry if this is a common sense question.</p>