file-drop icon indicating copy to clipboard operation
file-drop copied to clipboard

Outdated readme about `filedrop` event's `file` property

Open Legend-Master opened this issue 2 years ago • 0 comments

It's files: File[] now

Respond to when a file is dropped on the element

When a user has succesfully dropped a file on to the element, the element will emit a filedrop event. The filedrop event contains a file property which is a direct reference to the File that was dropped.

<file-drop id="dropTarget">Drop a file here</file-drop>

<script>
dropTarget.addEventListener('filedrop', (e) => {
  dropTarget.textContent = e.file.name;
});
</script>

Note: if more than one file is dropped on the element, only the first file will be included on the event.

Legend-Master avatar Jul 22 '23 13:07 Legend-Master