// Use the contextBridge module to accomplish this securely:
// preload.js
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('myAPI', {
desktop: true
})
// renderer.js
console.log(window.myAPI)
// => { desktop: true }