chrome.devtools.inspectedWindow更改事件 [英] chrome.devtools.inspectedWindow change event
问题描述
Google Chrome浏览器扩展程序API使用chrome.devtools.inspectedWindow提供有关当前打开的窗口的信息,但它不提供更改时的事件。我可能会刷新或重定向页面,我希望我要添加的DevTools面板得到通知。是否有这样的方法?
The Google Chrome extension API provides info on the currently open window, using chrome.devtools.inspectedWindow, but it doesn't provide events for when it changes. I may refresh or redirect the page and I'd like the DevTools panel I'm adding to be notified. Is there a method for this?
想一想Elements面板,它总是与当前的DOM保持同步。这可能很难实现,以便像DOM一样保持最新状态,每当DOM突变发生时,但至少在加载新页面时通知我(至少在document.onload事件中,为什么不) )
Think of the Elements panel, it always stays up to date with the current DOM. This might be hard to implement in order to stay up to date like it does, whenever a DOM mutation happens, but I'd like at least to be notified when a new page is loaded (probably on the document.onload event, why not)
关于如何实现这个的任何想法,谢谢?
Any ideas on how to implement this, thanks?
推荐答案
收听其中一个 chrome.webNavigation
事件,并在发生更新时通知 devtools。
Listen to one of the chrome.webNavigation
events, and notify the devtools whenever an update occurs.
另一种检测被卸载的页面的方法是使用 chrome.devtools.network.onNavigated
事件(只在您的devtools扩展页面中可用)。
Another way to detect that the inspected page is being unloaded is to use the chrome.devtools.network.onNavigated
event (only available within your devtools extension page).
这篇关于chrome.devtools.inspectedWindow更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!