Horje
electron communicate between main and renderer Code Example
electron communicate between main and renderer
// 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
electron communicate between main and renderer
// In renderer process (web page).
const { ipcRenderer } = require('electron')
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"

ipcRenderer.on('asynchronous-reply', (event, arg) => {
  console.log(arg) // prints "pong"
})
ipcRenderer.send('asynchronous-message', 'ping')
Copy




Javascript

Related
Install Discord.js Code Example Install Discord.js Code Example
add formdata to axios request in js Code Example add formdata to axios request in js Code Example
angular lifecycle hooks Code Example angular lifecycle hooks Code Example
average of an array js Code Example average of an array js Code Example
Set Custom User Agent react Code Example Set Custom User Agent react Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7