Clipboard

external interface Clipboard(source)

Properties

Link copied to clipboard
abstract external val selection: Clipboard

A Clipboard property — a Clipboard object on Linux that operates against the selection clipboard instead of the system clipboard, and undefined on all other platforms. It exposes the same read, write, readText, writeText, has, and clear methods as the top-level clipboard module.

Functions

Link copied to clipboard
abstract external fun clear()

Clears the clipboard content.

Link copied to clipboard
abstract external fun has(mimetype: String): Promise<Boolean>

A promise that resolves with true if the clipboard contains data of the specified mimetype, otherwise false. To check for a raw format, eg public/utf8-plain-text, use the electron application/osclipboard custom format (electron application/osclipboard;format="public/utf8-plain-text").

Link copied to clipboard
abstract external fun read(): Promise<ReadonlyArray<ClipboardItem>>

A promise that resolves with an array of ClipboardItem objects containing the clipboard's contents.

Link copied to clipboard
abstract external fun readText(): Promise<String>

A promise that resolves with the content of the clipboard as plain text. Modeled after the W3C navigator.clipboard.readText API.

Link copied to clipboard
abstract external fun write(data: ReadonlyArray<ClipboardItem>): Promise<Void>

Resolves once the data has been written to the clipboard. All entries supplied in a single write() call are committed to the system clipboard atomically.

Link copied to clipboard
abstract external fun writeText(text: String): Promise<Void>

A promise that resolves once the text has been written to the clipboard. Modeled after the W3C navigator.clipboard.writeText API.