5.20202.732
wijmo.touch Class DataTransfer Wijmo API Class

DataTransfer Class

Object used to hold the data that is being dragged during drag and drop operations.

It may hold one or more data items of different types. For more information about drag and drop operations and data transfer objects, see HTML Drag and Drop API.

This object is created automatically by the DragDropTouch singleton and is accessible through the {@link dataTransfer} property of all drag events.

Heirarchy

  • DataTransfer

Properties

dropEffect

dropEffect: string

Gets or sets the type of drag-and-drop operation currently selected. The value must be 'none', 'copy', 'link', or 'move'.

effectAllowed

effectAllowed: string

Gets or sets the types of operations that are possible. Must be one of 'none', 'copy', 'copyLink', 'copyMove', 'link', 'linkMove', 'move', 'all' or 'uninitialized'.

types

types: string[]

Gets an array of strings giving the formats that were set in the dragstart event.

Methods

clearData

  • clearData(type?: string): void
  • Removes the data associated with a given type.

    The type argument is optional. If the type is empty or not specified, the data associated with all types is removed. If data for the specified type does not exist, or the data transfer contains no data, this method will have no effect.

    Parameters

    • Optional type: string

      Type of data to remove.

    Returns void

getData

  • getData(type: string): string
  • Retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer contains no data.

    Parameters

    • type: string

      Type of data to retrieve.

    Returns string

setData

  • setData(type: string, value: string): void

setDragImage

  • setDragImage(img: HTMLElement, offsetX: number, offsetY: number): void
  • Set the image to be used for dragging if a custom one is desired.

    Parameters

    • img: HTMLElement

      An image element to use as the drag feedback image.

    • offsetX: number

      The horizontal offset within the image.

    • offsetY: number

      The vertical offset within the image.

    Returns void