JavaScripture
Contribute via GitHub Feedback

DataTransferItem : Object

DataTransferItem represents an item that can is being dragged. There can be more than one DataTransferItem for a drag and drop operation. For example, dragging a document may have a DataTransferItem containing the rich text and a DataTransferItem containing the plain text.

Instance Properties

kind : String  

The kind of the item. Will be one of 'string' or 'file'.

Example:

Run

Results:

 

type : String  

The mime type of the item, such as 'text/plain', 'image/png', etc.

Example:

Run

Results:

 

Instance Methods

getAsFile() : File

Returns the File data for this. Only valid if kind is 'file'.

Example:

Run

Results:

 

getAsString(callback : Function) : undefined
callback(data : String) : undefined

Calls callback with the text data for this. Only valid if kind is 'string'.

Example:

Run

Results: