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 attachDebugger from '../../utils/attachDebugger'
import userAgents from '../../utils/userAgents' import userAgents from '../../utils/userAgents'
chrome.tabs.onCreated.addListener((tab) => { const attachTab = (tabId) => {
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) => {
chrome.debugger.getTargets((tabs) => { chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === tabId) const currentTab = tabs.find((obj) => obj.tabId === tabId)
if (!currentTab.attached) { if (!currentTab.attached) {
attachDebugger(tabId) 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) => { chrome.alarms.onAlarm.addListener((alarm) => {

View file

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

View file

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