Files
tout-doux/resources/ts/lib/share.ts
T
klemek 84630f2049
TS Lint / TypeScript (push) Successful in 6m0s
TS Lint / ESLint (push) Successful in 6m0s
TS Lint / Oxlint (push) Successful in 6m0s
feat: share list
2026-07-14 14:49:22 +02:00

17 lines
355 B
TypeScript

export async function shareLink(
title: string,
text: string,
url: string,
): Promise<boolean> {
try {
if (navigator.canShare()) {
await navigator.share({ title, text, url });
return true;
}
} catch {
// do nothing
}
await navigator.clipboard.writeText(url);
return false;
}