IPC as proxy of Main class instance


#1

Hello there,

is that possible to use IPC (or another method) to access to a class instance in Main from the renderer view, like a proxy?

naive exemple:

// In main process.
var Foo = new FooBar()

ipcMain.on('ask-proxy', function(event, arg) {
  event.sender.send('proxy-reply', Foo)
})

// In renderer process (web page).
ipcRenderer.on('proxy-reply', function(event, arg) {
  console.log( typeof arg.someFooMethod); // prints "function"
});
ipcRenderer.send('ask-proxy');

Thanks


#2

Take a look at the remote API. I think it offers what you’re describing.


#3

Thanks, that is exactly what I was looking for. :slight_smile: