2

我最近为 devtools 创建了一个扩展,它在 devtools 上添加了一个新的ExtensionPanel。由于此面板仅在某些页面上有用,因此我想根据当前页面的内容有条件地显示它。我可以根据页面的上下文动态创建一个面板,但是我找不到任何关闭它的方法(我已经尝试过window.close(),面板本身没有任何这样的方法)。

所以我的问题是:有没有办法以编程方式关闭ExtensionPanel ?

4

1 回答 1

2

This is not supported by DevTools at the moment -- if you add a panel or sidebar, it's for the life of DevTools front-end. All stock DevTools panels are displayed unconditionally and the rationale for the lack of API methods to remove panels is to avoid confusion created by panels coming and going. If a panel is not applicable to the page being inspected at the moment, you can perhaps display a banner explaining why it's not applicable.

于 2013-09-26T05:47:01.593 回答