title: Would I be able to give access to specific electron APIs safely?
body: <p>So I need to find a way to create custom window titleBar buttons that I can add functionality to safely without enabling nodeIntegration in electron. I was thinking the <a href="https://electronjs.org/docs/api/browser-window" rel="nofollow noreferrer">preload</a> might be what I need but I'm not sure how this works or if it would work for this.</p>
  
  <p>Since I'm creating custom window buttons with HTML, CSS and Javascript, I need these methods:</p>
  
  <pre><code>mainWindow.minimize();
  mainWindow.close();
  mainWindow.getBounds();
  mainWindow.setBounds(...);
  mainWindow.setResizable(...);
  </code></pre>
  
  <p>This is in the renderer process so nodeIntegration would need to be enabled and would need to use remote like this:</p>
  
  <pre><code>const { remote } = require('electron');
  const mainWindow = remote.getCurrentWindow();
  </code></pre>
  
  <p>Would I be able to use the preload option with nodeIntegration disabled to access these methods to add functionality to my custom buttons? If so, how? Would it be safe this way?</p>