Assert accessing id on an actual tab

This commit is contained in:
Sebastian Velez
2023-04-28 09:33:12 -05:00
parent 9ab4016f29
commit 7e6afd3527

View File

@@ -43,9 +43,12 @@ browser.windows.onFocusChanged.addListener(async (windowId) => {
browser.tabs.onUpdated.addListener(async (tabId, changeInfo) => {
if (changeInfo.status === 'complete') {
// Get current tab URL.
const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
const tabs: browser.Tabs.Tab[] = await browser.tabs.query({
active: true,
currentWindow: true,
});
// If tab updated is the same as active tab
if (tabId == tab.id) {
if (tabId == tabs[0]?.id) {
await WakaTimeCore.recordHeartbeat();
}
}