mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
2bd9337e63
Co-authored-by: Maison da Silva <maisonmdsgreen@hotmail.com>
29 lines
634 B
TypeScript
29 lines
634 B
TypeScript
import { trackError } from "@/features/analytics";
|
|
import { PublicPath } from "wxt/browser";
|
|
|
|
export default async function sendNotification(props: NotificationProps): Promise<void>
|
|
{
|
|
try
|
|
{
|
|
await browser.notifications.create({
|
|
type: "basic",
|
|
title: props.title,
|
|
message: props.message,
|
|
iconUrl: browser.runtime.getURL(props.icon)
|
|
});
|
|
}
|
|
catch (ex)
|
|
{
|
|
console.error("Error while showing notification (probably because of user restrictions)");
|
|
console.error(ex);
|
|
trackError("notification_error", ex as Error);
|
|
}
|
|
}
|
|
|
|
export type NotificationProps =
|
|
{
|
|
title: string;
|
|
message: string;
|
|
icon: PublicPath;
|
|
};
|