Added attachTab functions

This commit is contained in:
z0ccc 2022-06-22 23:27:52 -04:00
parent 71d314ce65
commit da0485b1f1
3 changed files with 14 additions and 16 deletions

View file

@ -1,26 +1,25 @@
import attachDebugger from '../../utils/attachDebugger'
import userAgents from '../../utils/userAgents'
chrome.tabs.onCreated.addListener((tab) => {
attachDebugger(tab.id)
})
chrome.tabs.onActivated.addListener((tab) => {
chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === tab.tabId)
if (!currentTab.attached) {
attachDebugger(tab.tabId)
}
})
})
chrome.tabs.onUpdated.addListener((tabId) => {
const attachTab = (tabId) => {
chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === tabId)
if (!currentTab.attached) {
attachDebugger(tabId)
}
})
}
chrome.tabs.onCreated.addListener((tab) => {
attachDebugger(tab.id)
})
chrome.tabs.onActivated.addListener((tab) => {
attachTab(tab.tabId)
})
chrome.tabs.onUpdated.addListener((tabId) => {
attachTab(tabId)
})
chrome.alarms.onAlarm.addListener((alarm) => {

View file

@ -32,7 +32,7 @@ const Navbar = () => (
>
<img
src={Link}
alt="Test Vytal"
alt="Test on vytal.io"
style={{
width: '18px',
height: '18px',

View file

@ -78,7 +78,6 @@ const attachDebugger = (tabId) => {
// { acceptLanguage: "en-CA" },
// { platform: "WebTV OS" }
)
// 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.69',
}
}
})