Using IPC: Only for Main and Renderer?


#1

I am just getting into IPC and remote stuff, so bear with me.

I am working on an app that allows a user to open several browser tabs at once. I’m working on allowing a user to click on a tab onscreen and edit its URL. Another, smaller child window should appear and from there the user can make any changes necessary and then save+close the window when they’re done.

I am aware of

const {IpcMain} = require('electron')

and

const {IpcRenderer} = require('electron')  

as ways to communicate and pass data between the processes, but that’s the only way conceivable to me to do anything like that.

In past examples (mostly 2015), I’ve seen people use

var ipc = require('ipc')

Which absolutely does not work for me, as I always get that error about ‘.on’ not being a function, or whatever it was. It would be really nice to have that right now, but I’m left with the impression that there’s only 2 possible places for IPCs to exist.

So, is it even possible to have an IPC in another .js file? Does remote have anything to do with it?
It’s all a bit confusing and seemingly lynch-pinnish right now, because I really need some way, whatever it looks like, to send some IPC messages from another .js file. I am open to substitutions and/or workarounds.

Please help, and cheers,

-Jon


#2

Wait, nevermind, I think I get it.

I was initially under the impression the {ipcRenderer} could only be in renderer.js. I am able to include it in several .js files with no problem, however, and it works just fine and will probably be able to do the things I had intended to do.

Sorry, I think I’ve answered my own problem for now… which probably made absolutely no sense to anyone, because with this new light I don’t think it makes sense to me either.

Cheers, self,

-Jon