You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's synchronous once the user begins the input (not on initialization). So there is an async gap between the code that sets up the reader and the user actually selecting a file. You can read more about this FileReaderSync object on MDN.
In your case, you could move 'step 3' and any logic within it into the load event and things would execute in the order you want.
The code run like
Step 1 -> Step 3 -> Step 2
I need to know the TypeArq content after reading the file, ie synchronous manner.
However, the contents of TypeArq return anything.
The Code:
var TypeArq = ""
alert("Step 1");
FileReaderJS.setSync(true);
FileReaderJS.setupInput(document.getElementById('input'), {
readAsDefault: "Text",
on: {
load: function(e, file) {
TypeArq = e.target.result.substring(1,8);
console.log("Funcionou--->" + e.target.result.substring(1,8));
alert("Step 2");
}
}
});
alert("Step 3");
alert(TypeArq)
The text was updated successfully, but these errors were encountered: