Skip to the content

Capsid menu

app/lib/clipboard.ts

8 lines and 2 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of clipboard.ts
FunctionLinesComplexityCoveredCRAPMutation
copyText6 to 81No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:7>7 to 71No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code

Imports

It imports no other module of this repo. Imported by app/components/admin/copy-button.tsx, app/components/admin/media-bulk-bar.tsx, app/components/admin/media-palette.tsx, app/enhance/blog.ts, app/enhance/cv.ts.

Source

/**
 * Copies text to the clipboard. Wrapped in a promise because with no clipboard (an insecure
 * context) the call throws before any promise exists, and every caller wants one failure path.
 * Client-safe and dependency-free: the enhancement bundles import it.
 */
export function copyText(text: string): Promise<void> {
  return Promise.resolve().then(() => navigator.clipboard.writeText(text));
}