I am currently developing a Chrome extension that is designed to monitor the amount of time a user spends on a website (aka an activity tracker). My strategy involves capturing the active and inactive states of the tab in order to calculate the total time spent, but I am encountering difficulties with detecting when the tab becomes inactive.
//// background.js
async function getCurrentTab() {
let queryOptions = { active: true, currentWindow: true };
let [tab] = await chrome.tabs.query(queryOptions);
return tab;
}
The provided code snippet is what I am utilizing to obtain information about the current tab.
Since this is my inaugural attempt at creating an extension,...