@jsvision/web / setClipboard
Function: setClipboard()
setClipboard(
text,_caps,clipboard?):Promise<void>
Defined in: clipboard.ts:41
Write text to the browser clipboard (outbound only).
Parameters
text
string
the text to copy.
_caps
CapabilityProfile
the capability profile, accepted for API symmetry with the native OSC-52 path; reserved (unused by the browser Clipboard API).
clipboard?
the clipboard bridge; defaults to navigator.clipboard. Inject a mock in tests.
Returns
Promise<void>
the write promise (resolves when written; may reject if there is no user gesture). Resolves to a no-op when no clipboard is available.
Example
ts
import { setClipboard, buildBrowserCaps } from '@jsvision/web';
// In a copy handler (a user gesture):
await setClipboard(selectedText, buildBrowserCaps());