mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import browser from 'webextension-polyfill'
|
|
interface ThemeList {
|
|
themes: string[];
|
|
selectedTheme: string;
|
|
}
|
|
|
|
export const downloadTheme = async (themeName: string, themeURL: string) => {
|
|
// send message to the background script
|
|
await browser.runtime.sendMessage({
|
|
type: 'currentTab',
|
|
info: 'DownloadTheme',
|
|
body: {
|
|
themeName: themeName,
|
|
themeURL: themeURL
|
|
}
|
|
});
|
|
}
|
|
|
|
export const setTheme = async (themeName: string, themeURL: string) => {
|
|
// send message to the background script
|
|
await browser.runtime.sendMessage({
|
|
type: 'currentTab',
|
|
info: 'SetTheme',
|
|
body: {
|
|
themeName: themeName,
|
|
themeURL: themeURL
|
|
}
|
|
});
|
|
}
|
|
|
|
export const listThemes = async () => {
|
|
// send message to the background script
|
|
const response: ThemeList = await browser.runtime.sendMessage({
|
|
type: 'currentTab',
|
|
info: 'ListThemes'
|
|
});
|
|
|
|
return response;
|
|
}
|
|
|
|
export const disableTheme = async () => {
|
|
await browser.runtime.sendMessage({
|
|
type: 'currentTab',
|
|
info: 'DisableTheme',
|
|
});
|
|
};
|
|
|
|
export const deleteTheme = async (themeName: string) => {
|
|
await browser.runtime.sendMessage({
|
|
type: 'currentTab',
|
|
info: 'DeleteTheme',
|
|
body: {
|
|
themeName: themeName
|
|
}
|
|
});
|
|
} |