Electron: How can I get the BrowserWindow id from a renderer process?

Created on 14 Mar 2016  ·  3Comments  ·  Source: electron/electron

Is this information somehow encoded in the renderer process?

Most helpful comment

Have you try this ?
require('electron').remote.getCurrentWindow().id

All 3 comments

Have you try this ?
require('electron').remote.getCurrentWindow().id

@abdihaikal Cheers, I missed that from the docs :)

Since Electron now has more things than 2 years ago, you can just go over the event of your IPC call and request the BrowserWindow that triggered the call:

event.sender.getOwnerBrowserWindow() has that. It returns a BrowserWindow Object with all the properties that it could have such: minimize(), close(), etc....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cniaulin picture cniaulin  ·  3Comments

ThorstenHans picture ThorstenHans  ·  3Comments

christiangenco picture christiangenco  ·  3Comments

sindresorhus picture sindresorhus  ·  3Comments

feross picture feross  ·  3Comments