为什么要为每个Chrome应用程序窗口打开一个新的“开发人员工具"窗口? [英] Why does a new Developer Tools window open for each Chrome App window?

查看:101
本文介绍了为什么要为每个Chrome应用程序窗口打开一个新的“开发人员工具"窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

接着是这个问题:如何可以在同一个Chrome应用的多个窗口之间进行通信?并回答,这就是为什么当您开发通过加载解压缩的扩展程序"加载并使用chrome.app.window.create()打开新窗口,然后右键单击-单击新窗口中的检查元素",您会得到一个 new 开发人员工具窗口,而不是已经为chrome应用程序的原始窗口打开的窗口?还是一个错误?

Following on from this question: How to communicate between multiple windows of the same chrome app? and answer, is this why when you are developing an app that you have loaded via 'load unpacked extension' and open a new window using chrome.app.window.create() and then right-click on the new window to 'Inspect Element' you get a new developer tools window and not the one already open for the original window of the chrome app? Or is it a bug?

我问,因为当我实际上使用开发工具(带有工作区)作为编写我的Chrome应用程序的实际IDE时,必须在不同的开发人员工具窗口之间进行切换非常耗时(我不是 使用任何其他外部文本编辑器或IDE)

I ask because its very time-consuming having to switch between the different developer tools windows when I'm actually using Dev Tools (with Workspaces) as the actual IDE for writing my Chrome app (I am not using any other external text editor or IDE)

推荐答案

这是Chrome中开发工具的局限性.建议的内容很酷,但是需要一些我们尚未完成的工作.

This is a limitation of dev tools in Chrome. What is being suggested would be pretty cool, but it would need some work that we haven't done.

请清楚一点,不同的窗口不会共享相同的JS全局上下文".出现引号是因为全局上下文"是一件事,它具有真正的含义.

Just to be clear, different windows do not share the same JS "global context". The quotes are there because the "global context" is a thing, it has a real meaning.

想象一下,有两个窗口A和B,它们生活在同一个JS世界中.如果两个窗口都可以引用,则两个窗口都可以访问Universe中的所有对象.将有两个窗口对象,即windowA和windowB.

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

全局上下文"指的是在哪个窗口对象范围内寻找标识符.

"Global context" refers to which window object unscoped identifiers are looked for in.

在窗口A的全局上下文"中运行代码时,将在窗口A的上下文中查找未范围的标识符.例如.将在windowA.foo上查找"foo".如果foo实际上在windowB上,则不会找到它.换句话说,如果在窗口A的全局上下文"中运行代码时创建全局变量,则实际上会将其放在windowA上.如果然后在窗口B的全局上下文中运行代码,则需要引用windowA才能访问它.

When running code in the "global context" of window A, unscoped identifiers will be looked up in the context of windowA. E.g. "foo" will be looked for on windowA.foo. If foo is actually on windowB it won't be found. Put another way, if you create a global variable while running code in the "global context" of window A, it will actually be put on windowA. If you then run code in the global context of window B, you will need to have a reference to windowA to be able to access it.

我希望这是有道理的;这很难解释.我可能也对此有一些更好的看法.

I hope that makes sense; it is kind of hard to explain. I've probably got some finer points of it wrong as well.

这篇关于为什么要为每个Chrome应用程序窗口打开一个新的“开发人员工具"窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆