Megha Dev
Megha Dev

Reputation: 180

How can I set the ID of a browser window?

Basically, I want to do some communication between 2 ipc renderers. Based on some information in https://github.com/electron/electron/issues/991, I am trying to set the id of a browser window which I'll eventually use to get the browser window and send the events across without involving main.js.

Need to know how i can set the id of a browser window.

I tried the following:

chatWindow = new BrowserWindow({
    x: 10,
    y: 10,
    width: 500, 
    height: 500,
    id: 1234,
});

The above didn't work. The following two didn't work either.

 chatWindow.id = 1234;
 chatWindow.id(1234);

Upvotes: 3

Views: 3759

Answers (2)

Vadim Macagon
Vadim Macagon

Reputation: 14847

You can't set the BrowserWindow id, it's generated by Electron.

Upvotes: 3

Jens Habegger
Jens Habegger

Reputation: 5446

The very same issue thread you mentioned also points to other-window-ipc, which seems like a great solution to your problem.

Even if you dont want to use yet another library, you'll probably find a pointer to implement the functionality itself within its sources.

Upvotes: 1

Related Questions