Encapsulates data transferred during drag and drop operations.

Constructor

new(value:Any)

@linkcode DataTransferItem.value}.

Parameters:

value

Custom data stored on this item. Can be retrieved using {

Variables

read onlyvalue:Any

Custom data stored on this item.

You can use value to share data across operations. The original object can be retrieved so long as the extension that created the DataTransferItem runs in the same extension host.

Methods

asFile():Null<DataTransferFile>

Try getting the {@link DataTransferFile file} associated with this data transfer item.

Note that the file object is only valid for the scope of the drag and drop operation.

Returns:

The file for the data transfer or undefined if the item is either not a file or the file data cannot be accessed.

asString():Thenable<String>

Get a string representation of this item.

If {@linkcode DataTransferItem.value} is an object, this returns the result of json stringifying {@linkcode DataTransferItem.value} value.