This is my function, how can I make it so that openFileBrowse() returns the outcome of the function tsvJSON() inside of the reader.onload?
export function openFileBrowse() {
  var input = document.getElementById("filebutton");
  if (input.files[0].type != "application/vnd.ms-excel"){
    alert("You have uploaded a wrong file type. We require a .csv file not a " + input.files[0].type + " file.");
  } else {
    var reader = new FileReader();
    var aftertext = "";
    reader.onload = function(){
      aftertext = reader.result;
      return tsvJSON(aftertext);
    };
    reader.onloadend = function(){
      console.log("loading finished");
    };
    reader.readAsText(input.files[0]);
  }
}
Thanks in advance!
 
    