Why do new developer tool windows open in every window in my Chrome app?

Following this question: How to communicate between multiple windows of the same chrome application? and answer, that’s why when you are developing an application that you have to boot through the “downloaded unzipped extension” and open a new window with chrome.app.window.create() , then right-click on the new window in “Inspect Element, "will you get a new developer tool window, not one that is already open for the original chrome application window? Or is this a mistake?

I ask because it takes a lot of time to switch between different windows of the developer tools when I actually use Dev Tools (with workspaces) as a real environment for writing my Chrome application (I do not use any other external text editor or IDE)

+2
source share
1 answer

This is a limitation of dev tools in Chrome. What is being offered will be pretty cool, but it will require some work that we have not done yet.

To be clear, different windows do not use the same "global context" JS. Quotation marks exist because the "global context" is a thing; it has real meaning.

Imagine there are two windows A and B, and they live in the same JS universe. All objects in the universe are accessible to both windows if they can get a link. There will be two window objects, windowA and windowB.

"Global context" refers to which object the window object identifiers are not attached to.

When you run code in the "global context" of window A, undefined identifiers will be viewed in the context of windowA. For instance. "foo" will search on windowA.foo. If foo is actually on windowB, it will not be found. In other words, if you create a global variable when you run the code in the "global context" of window A, it will actually be placed in windowA. If you then run the code in the global context of window B, you will need to have a link to windowA in order to access it.

Hope this makes sense; it is hard to explain. I probably also had some subtleties.

+1
source

All Articles