Files
frigate/web/src/utils/browserUtil.ts
T

18 lines
420 B
TypeScript
Raw Normal View History

2024-09-12 08:46:29 -06:00
import copy from "copy-to-clipboard";
import { t } from "i18next";
2024-09-12 08:46:29 -06:00
import { toast } from "sonner";
export function shareOrCopy(url: string, title?: string) {
if (window.isSecureContext && "share" in navigator) {
navigator.share({
url: url,
title: title,
});
} else {
copy(url);
2025-03-17 07:26:01 -05:00
toast.success(t("toast.copyUrlToClipboard", { ns: "common" }), {
2024-09-12 08:46:29 -06:00
position: "top-center",
});
}
}