diff --git a/index.bs b/index.bs index a020bec..5955496 100644 --- a/index.bs +++ b/index.bs @@ -1796,20 +1796,19 @@ elem.addEventListener('dragover', (e) => { // Prevent navigation. e.preventDefault(); }); + elem.addEventListener('drop', async (e) => { - // Prevent navigation. e.preventDefault(); - // Process all of the items. - for (const item of e.dataTransfer.items) { - // kind will be 'file' for file/directory entries. - if (item.kind === 'file') { - const entry = await item.getAsFileSystemHandle(); - if (entry.kind === 'file') { - handleFileEntry(entry); - } else if (entry.kind === 'directory') { - handleDirectoryEntry(entry); - } + const fileHandlesPromises = [...e.dataTransfer.items] + .filter(item => item.kind === 'file') + .map(item => item.getAsFileSystemHandle()); + + for await (const handle of fileHandlesPromises) { + if (handle.kind === 'directory') { + console.log(`Directory: ${handle.name}`); + } else { + console.log(`File: ${handle.name}`); } } });