Added try/catch handling and some comments

This commit is contained in:
2025-11-11 16:02:07 +01:00
parent f4c45f8371
commit da3a8c7d8c
3 changed files with 78 additions and 39 deletions
+26 -15
View File
@@ -2,21 +2,32 @@
const dropzone = document.getElementById("uploadContainer");
dropzone.addEventListener("dragover", (e) =>{
e.stopPropagation();
e.preventDefault();
});
dropzone.addEventListener("drop", (e) => {
e.stopPropagation()
e.preventDefault()
const files = e.dataTransfer.files
const filePath = window.explorer.onFileDrop(files[0])
var holdy = filePath + "";
if(holdy.endsWith(".mp4")){
console.log(filePath)
const files1 = e.dataTransfer.files;
handleFiles(files1);
try {
e.stopPropagation();
e.preventDefault();
} catch (error) {
console.log("Error in renderer.js dragover listener function")
}
});
//listener for when a file get dropped on the drag&drop field
dropzone.addEventListener("drop", (e) => {
try {
e.stopPropagation()
e.preventDefault()
const files = e.dataTransfer.files
const filePath = window.explorer.onFileDrop(files[0])
var holdy = filePath + "";
if(holdy.endsWith(".mp4")){
console.log(filePath)
const files1 = e.dataTransfer.files;
handleFiles(files1);
}
} catch (error) {
console.log("Error in renderer.js with the listerner for the drop function");
}
})