Clipboard
The system clipboard manager.
import { clipboard } from '@mobrowser/api';
Example
import { clipboard } from '@mobrowser/api';
clipboard.write('text/plain', 'Hello world')
const text = clipboard.read('text/plain')
Properties
changeCount
readonly changeCount: number;
The number of times the clipboard has been changed (macOS only).
Methods
getTypes()
getTypes(): ClipboardType[];
Returns the types available in the clipboard.
has()
has(type: ClipboardType): boolean;
Checks if the clipboard has the given type.
| Parameter | Type | Description |
|---|---|---|
type | ClipboardType | The type to check if the clipboard has. |
read()
read(type: ClipboardType): string;
Reads the data from the clipboard.
| Parameter | Type | Description |
|---|---|---|
type | ClipboardType | The type of the data to read. |
Return value
The data from the clipboard.
write()
write(type: ClipboardType, data: string): void;
Writes the data to the clipboard.
| Parameter | Type | Description |
|---|---|---|
type | ClipboardType | The type of the data to write. |
data | string | The data to write to the clipboard. |
clear()
clear(): void;
Clears the clipboard.