0👍
You can pass any data you want via IPC:
- in the Main process: https://www.electronjs.org/docs/api/ipc-main
- in the Renderer process: https://www.electronjs.org/docs/api/ipc-renderer
Here is an example:
// In main process.
const { ipcMain } = require('electron')
ipcMain.on('hey', (event, arg) => {
console.log('hey from win', arg) // prints "{a: 2}" in main process console
})
// send message to your window when it ready (win is your window)
win.webContents.send('hi', {data: 'is here'})
import { ipcRenderer } from 'electron'
ipcRenderer.on('hi', (e, payload) => {
console.log('hi from main', payload) // prints: {data: 'is here'} in dev tools
})
ipcRenderer.send('hey', 'ping', {a: 2})
Source:stackexchange.com