title: electron js cant read preload script function
body: <p>I want to run a function to close the app when the user clicks a button.</p>
  <p>In my preload I have</p>
  <pre><code>const { contextBridge, app } = require('electron')
  
  contextBridge.exposeInMainWorld('mainMethods',{
       quit : () =&gt; {
          console.log(app);
  app.quit()
  
  }
  })
  </code></pre>
  <p>When I call this function from my render script</p>
  <pre><code>var quitbutton= document.getElementById('launch');
  quitbutton.addEventListener('click',function(){
      window.mainMethods.quit()
    })
  </code></pre>
  <p>The function runs, but returns null for app? Why cant it find app?
  <a href="https://i.stack.imgur.com/jdok4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jdok4.png" alt="enter image description here" /></a></p>