Clipboard

EventTargetjs.html.Clipboard (extern class)

The Clipboard interface implements the Clipboard API, providing—if the user grants permission—both read and write access to the contents of the system clipboard.

Documentation Clipboard by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Instance Members

Requests arbitrary data (such as images) from the clipboard, returning a Promise. When the data has been retrieved, the promise is resolved with a DataTransfer object that provides the data.

Returns
js.lib.Promise<DataTransfer>

readText(): js.lib.Promise<String>

Requests text from the system clipboard; returns a Promise which is resolved with a DOMString containing the clipboard's text once it's available.

Returns
js.lib.Promise<String>

Writes arbitrary data to the system clipboard. This asynchronous operation signals that it's finished by resolving the returned Promise.

Name Type
data DataTransfer
Returns
js.lib.Promise<Void>

writeText(data: String): js.lib.Promise<Void>

Writes text to the system clipboard, returning a Promise which is resolved once the text is fully copied into the clipboard.

Name Type
data String
Returns
js.lib.Promise<Void>