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

The DataTransfer.dropEffect property controls the feedback (typically visual) the user is given during a drag and drop operation.

Link copied to clipboard

The DataTransfer.effectAllowed property specifies the effect that is allowed for a drag operation.

Link copied to clipboard

The files read-only property of DataTransfer objects is a list of the files in the drag operation.

Link copied to clipboard

The read-only items property of the DataTransfer interface is a A DataTransferItemList object containing DataTransferItem objects representing the items being dragged in a drag operation, one list item for each object being dragged.

Link copied to clipboard

The DataTransfer.types read-only property returns the available types that exist in the DataTransfer.items.

Functions

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

The DataTransfer.clearData() method removes the drag operation's drag data for the given type.

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

The DataTransfer.getData() method retrieves drag data (as a string) for the specified type.

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

The DataTransfer.setData() method sets the drag operation's drag data to the specified data and type.

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

When a drag occurs, a translucent image is generated from the drag target (the element the HTMLElement/dragstart_event event is fired at), and follows the mouse pointer during the drag.