Clipboard
1. Get clipboard text
SDK function: getClipboardText
A function that reads the text stored in the clipboard.
Signature
function getClipboardText(): Promise<string>;Return value
Promise<string>Returns the text stored in the clipboard. If there is no text in the clipboard, returns an empty string.
Permission methods
getClipboardText.getPermission
Returns the current status of clipboard read permission.
allowed·denied·notDetermined·osPermissionDeniedreturns one ofgetClipboardText.openPermissionDialog
Shows a dialog to request clipboard read permission again. If allowed,
allowed, if denieddeniedis returned.
Error
If permission is denied GetClipboardTextPermissionErroroccurs. error instanceof GetClipboardTextPermissionErrorYou can check it with
Example
2. Copy clipboard text
SDK function: setClipboardText
A function that copies text to the clipboard. The user can paste it elsewhere.
Signature
Parameters
text · Required ·
stringThe text to copy to the clipboard.
Permission methods
setClipboardText.getPermission
Returns the current status of clipboard write permission.
allowed·denied·notDetermined·osPermissionDeniedreturns one ofsetClipboardText.openPermissionDialog
Shows a dialog to request clipboard write permission again. If allowed,
allowed, if denieddeniedis returned.
Error
If permission is denied SetClipboardTextPermissionErroroccurs. error instanceof SetClipboardTextPermissionErrorYou can check it with
Example
Last updated
Was this helpful?