Sign up (with export icon)

ViewDataTransfer

Api-class iconclass

A facade over the native DataTransfer object.

Properties

  • Chevron-right icon

    dropEffect: 'link' | 'none' | 'copy' | 'move'

    Parameters

    value: 'link' | 'none' | 'copy' | 'move'
  • Chevron-right icon

    effectAllowed: 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'

    Parameters

    value: 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'
  • Chevron-right icon

    files: Array<File>
    readonly

    The array of files created from the native DataTransfer#files or DataTransfer#items.

  • Chevron-right icon

    isCanceled: boolean
    readonly

    Whether the dragging operation was canceled.

  • Chevron-right icon

    types: readonly Array<string>
    readonly

    Returns an array of available native content types.

  • Chevron-right icon

    _files: Array<File> | null
    Lock iconprivate

    The array of files created from the native DataTransfer#files or DataTransfer#items.

  • Chevron-right icon

    _native: DataTransfer
    Lock iconprivate

    The native DataTransfer object.

Methods

  • Chevron-right icon

    constructor( nativeDataTransfer, options = { options.cacheFiles? } )

    Parameters

    nativeDataTransfer: DataTransfer

    The native DataTransfer object.

    options: object
    Properties
    options.cacheFiles?: boolean

    Whether files list should be initialized in the constructor.

    Defaults to {}

  • Chevron-right icon

    getData( type ) → string

    Gets the data from the data transfer by its MIME type.

    dataTransfer.getData( 'text/plain' );
    Copy code

    Parameters

    type: string

    The MIME type. E.g. text/html or text/plain.

    Returns

    string
  • Chevron-right icon

    setData( type, data ) → void

    Sets the data in the data transfer.

    Parameters

    type: string

    The MIME type. E.g. text/html or text/plain.

    data: string

    Returns

    void
  • Chevron-right icon

    setDragImage( image, x, y ) → void

    Set a preview image of the dragged content.

    Parameters

    image: Element
    x: number
    y: number

    Returns

    void