()
| 288 | }; |
| 289 | |
| 290 | export const getCurrentTab = async () => { |
| 291 | try { |
| 292 | // case normal popup |
| 293 | let tabs = await chrome?.tabs?.query?.({ |
| 294 | active: true, |
| 295 | currentWindow: true, |
| 296 | }); |
| 297 | if (tabs?.[0]?.url !== getPopupURL()) return tabs[0]; |
| 298 | |
| 299 | return await getLastFocusedTab(); |
| 300 | } catch (err) { |
| 301 | console.log(err); |
| 302 | return null; |
| 303 | } |
| 304 | }; |
| 305 | |
| 306 | export const getCurrentTabId = async () => { |
| 307 | return (await getCurrentTab())?.id; |
no test coverage detected