I assume that you are talking about the main process and other browser windows.
You can use BrowserWindow.webContents.send(channel[, arg1][, arg2][, ...])to send messages from the main process to the browser window and receive it using ipcRenderer. Take this example:
The main process:
subWindow.webContents.send("foo","bar");
BrowserWindowcalled subWindow:
var ipc=require("electron").ipcRenderer;
ipc.on("foo",(event, arg1) => {
console.log(arg1); //Outputs "bar"
});
If you want to send data from a browser window to the main process, use remote.app.emit. Get it with app.on. The same example:
The main process:
var app=require("electron").app;
app.on("test",(arg) => {
if (arg=="hey!") console.log("ha!");
}
SubWindow:
require("electron").remote.app.emit("test","hey!");
source
share