Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

358 B
Raw Blame
export type ClipboardWriter = Pick<Clipboard, "writeText">;

export const copyToClipboard = async (
  text: string,
  clipboard: ClipboardWriter = navigator.clipboard,
): Promise<boolean> => {
  try {
    await clipboard.writeText(text);
    return true;
  } catch (error) {
    console.error("Failed to copy to clipboard:", error);
    return false;
  }
};