This commit is contained in:
go0p
2024-05-15 14:43:04 +08:00
committed by go0p
parent fb0a20b065
commit 0c8f82b441
3 changed files with 32 additions and 14 deletions
+11 -1
View File
@@ -50,5 +50,15 @@ export namespace wsc {
chrome.runtime.sendMessage({action: ActionType.CLEARPROXY})
}
export function getTabId() {
return new Promise<number>((resolve, reject) => {
chrome.tabs.query({ active: true, lastFocusedWindow: true }, function (tabs) {
if (tabs.length) {
resolve(tabs[0].id);
} else {
reject('No active tab found');
}
});
});
}
}