I am creating a reader for parsing an excel file. Below is my async function.
let readExcelhelper2 = async function () {
        console.log("readExcelHelper2 - start");
        //Parsing the excel file
        let reader = new FileReader();
        reader.readAsBinaryString(file);
        let didErrorOccur = false;
        console.log("readExcelHelper2 - mid");
        reader.onload = await function () {
            console.log("reader.onload");
            let data = reader.result;
            let workbook = XLSX.read(data, {type: 'binary'});
            let wsList = [];
            workbook.SheetNames.map(function (sheetName) {
                wsList.push(workbook.Sheets[sheetName]);
            });
            //console.log(wsList);
            if (wsList.length !== 1) {
                errorState['isError'] = true;
                errorState['listOfErrors'].push('The excel file should have exactly one sheet!');
                didErrorOccur = true;
            }
            if (didErrorOccur)
                return;
            readExcelHelper(wsList[0]);
        };
        console.log("readExcelHelper2- end");
        console.log(errorState);
        return {'classifiers': classifiers, 'errorState': errorState};
    };
This is the console log when readExcelHelper2 is called:
readExcelHelper2 - start
readExcelHelper2 - mid
readExcelHelper2- end
//A bunch of other things
reader.onload
Shouldn't it await on reader.onload to complete? Why is it not doing that?
