ipcMain 报错 event.reply is not a function

Development of electron-vue, regarding event.reply is not a function problems.

When the main page rendering process to the time of communication, the following code


const { ipcMain } = require('electron');
ipcMain.on('asynchronous-message', (event, arg) => {
  console.log('asynchronous-message', event.reply, arg); // prints "ping"
  // event.sender.send("asynchronous-reply", 'as-pong')
  event.reply('asynchronous-reply', 'as-pong')
})

And may be related version, use event.sender.send alternative reply on it.

https://stackoverflow.com/questions/57038073/ipcmain-event-reply-is-not-a-function

About the main process and rendering process communication can look at this https://wizardforcel.gitbooks.io/electron-doc/content/api/ipc-main.html references, or official documents.

Guess you like

Origin www.cnblogs.com/juwan/p/12173922.html