switched tab api for webNavigation
This commit is contained in:
parent
0012a62f15
commit
38328ce473
2 changed files with 5 additions and 15 deletions
|
|
@ -1,22 +1,12 @@
|
||||||
import attachDebugger from '../utils/attachDebugger'
|
import attachDebugger from '../utils/attachDebugger'
|
||||||
|
|
||||||
const attachTab = (tabId: number) => {
|
const attachTab = (e: any) => {
|
||||||
chrome.debugger.getTargets((tabs) => {
|
chrome.debugger.getTargets((tabs) => {
|
||||||
const currentTab = tabs.find((obj) => obj.tabId === tabId)
|
const currentTab = tabs.find((obj) => obj.tabId === e.tabId)
|
||||||
if (!currentTab?.attached) {
|
if (!currentTab?.attached) {
|
||||||
attachDebugger(tabId)
|
attachDebugger(e.tabId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.tabs.onCreated.addListener((tab) => {
|
chrome.webNavigation.onBeforeNavigate.addListener(attachTab)
|
||||||
tab.id && attachDebugger(tab.id)
|
|
||||||
})
|
|
||||||
|
|
||||||
chrome.tabs.onActivated.addListener((tab) => {
|
|
||||||
attachTab(tab.tabId)
|
|
||||||
})
|
|
||||||
|
|
||||||
chrome.tabs.onUpdated.addListener((tabId) => {
|
|
||||||
attachTab(tabId)
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"description": "__MSG_extDesc__",
|
"description": "__MSG_extDesc__",
|
||||||
"author": "__MSG_extName__",
|
"author": "__MSG_extName__",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"permissions": ["storage", "debugger"],
|
"permissions": ["storage", "debugger", "webNavigation"],
|
||||||
"background": { "service_worker": "background.bundle.js" },
|
"background": { "service_worker": "background.bundle.js" },
|
||||||
"action": {
|
"action": {
|
||||||
"default_popup": "popup.html",
|
"default_popup": "popup.html",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue