IPC printing out "Object"


#1

I’m setting up an IPC between the renderer process and a preloaded script in a webview. They both are receiving each other’s pings, but I can’t seem to print the one that comes into the preloaded script. Here’s the code:

Renderer.js

loader.addEventListener("dom-ready", function() {
  console.log("loaded");
  loader.openDevTools();
  loader.send("incoming", "boom");
});

Preload.js

var ipc = require("electron").ipcRenderer;
ipc.on("incoming", function(message){
  console.log("nice");
  console.log(message);
})

The webview’s console prints “nice” but then just comes up with an expandable "Object" after that. I’ve tried logging message.arg[0] but that comes up undefined. Any ideas? Thanks.


#3

In newer versions of Electron the signature is:

ipc.on("incoming", function(eventObject, message){...