electron ipc code example
Example 1: electron send message from renderer to main
const { ipcRenderer } = require('electron')
// inside a renderer process
ipcRenderer.send('text', {
data: "some data"
})
Example 2: electronjs ipc doesn't work
//index
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.webContents.send('test','This is a test');
})
//render
ipcRenderer.on('test', (evt,data) => {
ipcRenderer.emit('end',true);
})