Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

DataTransfer

Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API.

interface DataTransfer {
dropEffect:
| "none"
| "copy"
| "link"
| "move";
effectAllowed:
| "none"
| "copy"
| "copyLink"
| "copyMove"
| "link"
| "linkMove"
| "move"
| "all"
| "uninitialized";
readonly files: FileList;
readonly items: DataTransferItemList;
readonly types: ReadonlyArray<string>;
clearData(format?: string): void;
getData(format: string): string;
setData(format: string, data: string): void;
setDragImage(
image: Element,
x: number,
y: number,
): void;
}
var DataTransfer: {
prototype: DataTransfer;
new (): DataTransfer;
}
;

§Properties

§
dropEffect: "none" | "copy" | "link" | "move"
[src]

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".

§
effectAllowed: "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized"
[src]

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",

§
readonly files: FileList
[src]

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

§

Returns a DataTransferItemList object, with the drag data.

§
readonly types: ReadonlyArray<string>
[src]

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".

§Methods

§
clearData(format?: string): void
[src]

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

§
getData(format: string): string
[src]

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

§
setData(format: string, data: string): void
[src]

Adds the specified data.

§
setDragImage(
image: Element,
x: number,
y: number,
): void
[src]

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