mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-05 12:50:41 +08:00
12 lines
288 B
JavaScript
12 lines
288 B
JavaScript
import Browser from 'webextension-polyfill'
|
|
|
|
export function openUrl(url) {
|
|
Browser.tabs.query({ url, currentWindow: true }).then((tabs) => {
|
|
if (tabs.length > 0) {
|
|
Browser.tabs.update(tabs[0].id, { active: true })
|
|
} else {
|
|
Browser.tabs.create({ url })
|
|
}
|
|
})
|
|
}
|