📜  主和渲染器之间的电子通信 - Javascript代码示例

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

代码示例2
// In main process.
const { ipcMain } = require('electron')
ipcMain.on('asynchronous-message', (event, arg) => {
  console.log(arg) // prints "ping"
  event.reply('asynchronous-reply', 'pong')
})

ipcMain.on('synchronous-message', (event, arg) => {
  console.log(arg) // prints "ping"
  event.returnValue = 'pong'
})
Copy