📜  电子预加载到渲染器 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:07.983000             🧑  作者: Mango

代码示例1
// 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 }