prevent running function when not needed

This commit is contained in:
ReznoRMichael 2021-01-23 15:01:14 +01:00
parent bc9971ec7b
commit e6bd87a866

View file

@ -36,12 +36,20 @@ let bench = {
* @param {FileList} input FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files.
*/
function LoadSaveFile(input, startTime = new Date()) {
// console.info("Input length: " + input.files.length)
// Cease further processing if user canceled the file input dialog
if (input.files.length < 1) return false;
// start benchmark
bench.begin.LSF = startTime;
// Prepares a File object from the first file of the input files for reading as an Array Buffer
let inputFileObject = input.files[0];
// Cleans the file list to avoid problems after subsequent use
// document.getElementById("save-area-file").value = "";
// 1. read file
// The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer.
// It is an array of bytes, often referred to in other languages as a "byte array".