adnbn
Version:
Addon Bone - Cross-browser web extension framework with shared code base
28 lines • 680 B
JavaScript
import { setActionIcon } from "@addon-core/browser";
import { DefaultIconGroupName } from "./../types/icon.js";
const getIcons = () => {
try {
return __ADNBN_ICONS__;
} catch (e) {
console.error("Failed getting icons: ", e);
}
return {};
};
const changeActionIcon = async (icon, tab) => {
if (!icon) {
icon = DefaultIconGroupName;
}
const icons = getIcons()[icon];
if (!icons) {
throw new Error(`Icon group name "${icon}" not found for action icon.`);
}
if (tab && typeof tab === "object") {
tab = tab.id;
}
await setActionIcon({ path: icons, tabId: tab });
};
export {
changeActionIcon,
getIcons
};
//# sourceMappingURL=icon.js.map