few bug fixes
This commit is contained in:
25
src/utils/action.ts
Normal file
25
src/utils/action.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { browser } from "wxt/browser"
|
||||
|
||||
export const setTitle = ({ title }: { title: string }) => {
|
||||
if (import.meta.env.BROWSER === "chrome") {
|
||||
chrome.action.setTitle({ title })
|
||||
} else {
|
||||
browser.browserAction.setTitle({ title })
|
||||
}
|
||||
}
|
||||
|
||||
export const setBadgeBackgroundColor = ({ color }: { color: string }) => {
|
||||
if (import.meta.env.BROWSER === "chrome") {
|
||||
chrome.action.setBadgeBackgroundColor({ color })
|
||||
} else {
|
||||
browser.browserAction.setBadgeBackgroundColor({ color })
|
||||
}
|
||||
}
|
||||
|
||||
export const setBadgeText = ({ text }: { text: string }) => {
|
||||
if (import.meta.env.BROWSER === "chrome") {
|
||||
chrome.action.setBadgeText({ text })
|
||||
} else {
|
||||
browser.browserAction.setBadgeText({ text })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user