MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / copyToClipboard

Function copyToClipboard

apps/baseai.dev/src/hooks/use-copy-to-clipboard.tsx:14–30  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

12 const [isCopied, setIsCopied] = React.useState<Boolean>(false);
13
14 const copyToClipboard = (value: string) => {
15 if (typeof window === 'undefined' || !navigator.clipboard?.writeText) {
16 return;
17 }
18
19 if (!value) {
20 return;
21 }
22
23 navigator.clipboard.writeText(value).then(() => {
24 setIsCopied(true);
25
26 setTimeout(() => {
27 setIsCopied(false);
28 }, timeout);
29 });
30 };
31
32 return { isCopied, copyToClipboard };
33}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected