Getting HTML5 Object from ipc.send


#1

In a preload webview, I “hook” the click event, to get some informations about some buttons on my webpage.
Sounds like

document.addEventListener('click', function(e) {
	var ipcRenderer = require('electron').ipcRenderer;
	ipcRenderer.send('click', e.srcElement);
});

On mainprocess, I received the event, but I cannot read HTML5 values of srcElement (value, nodeName, …)

Why ?

Thanks for your help


#2

The renderer process and the main process are just that, separate OS-level processes. In the documentation it states:

Arguments will be serialized in JSON internally and hence no functions or prototype chain will be included.

The basic message is that you can send raw data across but anything more heavy weight than that, such as DOM nodes, won’t make it across the process barrier intact. It’s best if you extract the information you need from the element on the renderer side and send the information across to the main process.


#3

Yes, sounds pretty logical indeed, because I wasn’t thinking it was a separate process. my fault :blush:

Thanks