Skip to content

DataTransfer

Types

t

type t = {
mutable dropEffect: string,
mutable effectAllowed: string,
items: WebAPI.DataTransferItemList.t,
types: array<string>,
files: WebAPI.DOM.fileList,
}

Record fields

dropEffect
string

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.

Can be set, to change the selected operation.

The possible values are "none", "copy", "link", and "move". Read more on MDN

effectAllowed
string

Returns the kinds of operations that are to be allowed.

Can be set (during the dragstart event), to change the allowed operations.

The possible values are "none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all", and "uninitialized", Read more on MDN

items

Returns a DataTransferItemList object, with the drag data. Read more on MDN

types
array<string>

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". Read more on MDN

files

Returns a FileList of the files being dragged, if any. Read more on MDN

Values

clearData

Removes the data of the specified formats. Removes all data if the argument is omitted. Read more on MDN

let clearData: (t, ~format: string=?) => unit

Parameters

~format: string=?

Return type

unit

getData

Returns the specified data. If there is no such data, returns the empty string. Read more on MDN

let getData: (t, string) => string

Parameters

string

Return type

string

make

let make: unit => t

Parameters

unit

Return type

t

setData

Adds the specified data. Read more on MDN

let setData: (t, ~format: string, ~data: string) => unit

Parameters

~format: string
~data: string

Return type

unit

setDragImage

Uses the given element to update the drag feedback, replacing any previously specified feedback. Read more on MDN

let setDragImage: (
t,
~image: WebAPI.DOMTree.element,
~x: int,
~y: int,
) => unit

Parameters

~x: int
~y: int

Return type

unit