Given a reference to a native
window global object, how can we get it’s associated
(This is opposite of what I’m asking in How can we get the native `window` from a BrowserWindow reference?).
For example, suppose I am using the native
window.open method to open a window, which gives me the new native
window of the opened window. I am currently using the following trick (hack?) to get the
window.open( ... ) // returns a native window object. const win = BrowserWindow.getFocusedWindow() // get the BrowserWindow of the window we just opened.
Is this reliable? There could be cases when the window isn’t focused, so this doesn’t seem like the ideal way to do it. Is there an official way to get the
BrowserWindow given a native
window object, that doesn’t rely on the window being focused?
But, maybe I’m not using
window.open and just have a reference to a native
window, and it seems like there should be some way to get the associated