The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

51722 (2) [Avatar] Offline
#1
In section 6.4.2, the code sets up a "getDraggedFile". This function errors when used in Listing 6.19 because "files" is an empty list, but you can access the file's type via "items". I'd suggest using something like the following:

const getDraggedFile = (event) => event.dataTransfer.items[0];

const getDroppedFile = (event) => event.dataTransfer.files[0];


Then use the appropriate function in the listings that follow.
Steve Kinney (33) [Avatar] Offline
#2
Hey! Thanks!

So, this is a known bug that popped up in Electron 1.7+. That chapter was written prior to that. Generally speaking,
files
should work, but the bug is actually in Chromium right now.
items
works some of the time, but not consistently in my testing. I am actively working to figure this out.

Issue on Github: https://github.com/electron/electron/issues/9840