DataTransfer

open class DataTransfer(source)

The DataTransfer object is used to hold any data transferred between contexts, such as a drag and drop operation, or clipboard read/write.

MDN Reference

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Returns the kind of operation that is currently selected. If the kind of operation isn't one of those that is allowed by the effectAllowed attribute, then the operation will fail.

Link copied to clipboard

Returns the kinds of operations that are to be allowed.

Link copied to clipboard

Returns a FileList of the files being dragged, if any.

Link copied to clipboard

Returns a DataTransferItemList object, with the drag data.

Link copied to clipboard

Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files".

Functions

Link copied to clipboard
fun clearData(format: String = definedExternally)

Removes the data of the specified formats. Removes all data if the argument is omitted.

Link copied to clipboard
fun getData(format: String): String

Returns the specified data. If there is no such data, returns the empty string.

Link copied to clipboard
fun setData(format: String, data: String)

Adds the specified data.

Link copied to clipboard
fun setDragImage(image: Element, x: Int, y: Int)

Uses the given element to update the drag feedback, replacing any previously specified feedback.