Pasteboard
Access the system clipboard
Pasteboard provides read and write access to the system clipboard (pasteboard).
Use Pasteboard to:
Examples
javascript
Pasteboard.copy("Hello World");
let text = Pasteboard.paste();
console.log(text);javascript
let img = await Photos.fromLibrary();
Pasteboard.copyImage(img);Methods
copy
Copy text to clipboard
typescript
static copy(string): voidstring- Text to copy
Example:
javascript
Pasteboard.copy("text")paste
Read text from clipboard
typescript
static paste(): string | nullReturns: Clipboard text content, or null if empty
Example:
javascript
let text = Pasteboard.paste()copyString
Copy text to clipboard (alias)
typescript
static copyString(string): voidstring- Text to copy
Example:
javascript
Pasteboard.copyString("text")pasteString
Read text from clipboard (alias)
typescript
static pasteString(): string | nullReturns: Clipboard text content, or null if empty
Example:
javascript
let text = Pasteboard.pasteString()copyImage
Copy image to clipboard
typescript
static copyImage(imageData): voidimageData- Image data object with base64 property
Example:
javascript
Pasteboard.copyImage(imageData)pasteImage
Read image from clipboard
typescript
static pasteImage(): object | nullReturns: Image data with base64, width, and height, or null if no image
Example:
javascript
let img = Pasteboard.pasteImage()