Skip to content

Commit ddafdd4

Browse files
committed
Get current tab function
1 parent edc7b84 commit ddafdd4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/compositions/current-tab.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Browser from 'webextension-polyfill';
2+
3+
export async function getCurrentTab(){
4+
const tabs = await Browser.tabs.query({ active: true, currentWindow: true });
5+
// since only one tab should be active and in the current window at once
6+
// the return variable should only have one entry
7+
return tabs[0];
8+
}

0 commit comments

Comments
 (0)