Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: new fabric canvas set width 
Javascript :: javascript check if is array 
Javascript :: aos animation react npm 
Javascript :: how to remove 000webhost watermark 2019 
Javascript :: regex only letters not spaces 
Javascript :: how to add bootstrap to vue js 
Javascript :: get value of element html js 
Javascript :: js exit fullscreen 
Javascript :: get docs with date intervals mongoose 
Javascript :: express static auth 
Javascript :: reactjs firebase where map value 
Javascript :: @angular/common 
Javascript :: a cypress command to refresh the whole page 
Javascript :: js html play beep 
Javascript :: js scrollto 
Javascript :: add class on javascript onclick function 
Javascript :: javascript find number in string 
Javascript :: fill array with random numbers javascript 
Javascript :: v-switch vuex store 
Javascript :: add 10 seconds to date javascript 
Javascript :: convert number to array javascript 
Javascript :: Format number thousands k javascript 
Javascript :: capital first letter react 
Javascript :: minimum flatlist size react native 
Javascript :: time difference in minutes in JS 
Javascript :: jquery copy all options from select to another 
Javascript :: How to know react and react-native version 
Javascript :: How to save input from box html 
Javascript :: nextjs socket.io 
Javascript :: https with express 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =