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 also:

Methods

read():Promise<DataTransfer>

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.

Throws:

null

DOMError

readText():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.

Throws:

null

DOMError

write(data:DataTransfer):Promise<Void>

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

Throws:

null

DOMError

writeText(data:String):Promise<Void>

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

Throws:

null

DOMError

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError