Skip to content

Consider adding DataTransferItem.kind #150963

Description

@alexdima

Testing #150321

The current DataTransferItem type looks like:

export class DataTransferItem {
  asString(): Thenable<string>;
  readonly value: any;
  constructor(value: any);
  /**
   * Try getting the file associated with this data transfer item.
   *
   * Note that the file object is only valid for the scope of the drag and drop operation.
   *
   * @returns The file for the data transfer or `undefined` if the item is not a file.
   */
  asFile(): DataTransferFile | undefined;
}

I find that it is not clear what the proposed behavior of .asString() should be for file items. It might be helpful to have a .kind property to help differentiate between types of things being transferred.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions