Mac OS X 10.11, Electron 0.36.1
If I create an object in the backend process, for instance:
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.getFullName = function() {
return this.firstName + " " + this.lastName;
}
}
and pass an instance of it to the renderer process:
let sam = new Person("sam", "joe");
mainWindow.webContents.on('did-finish-load', function() {
mainWindow.webContents.send('person', sam);
})
From the renderer process, I can access the variables of the object (firstName, lastName) but not the function (getFullName()).
Looking at the debug console, the object inside the renderer process appears to be exactly the same as that in the main process, but missing the functions.
IPC send serializes the object a-la JSON.stringify