Browse Source

Updates the image preview to update immediately

pull/390/head
MoeBrowne 5 years ago
parent
commit
a86cb05519
No known key found for this signature in database
GPG Key ID: 740672F2DA820F55
  1. 14
      demo.js

14
demo.js

@ -212,13 +212,6 @@ document.body.addEventListener('drop', async function(e){ @@ -212,13 +212,6 @@ document.body.addEventListener('drop', async function(e){
e.preventDefault();
var file = e.dataTransfer.files[0]
var reader = new FileReader();
await worker.load();
await worker.loadLanguage(language);
await worker.initialize(language);
const { data } = await worker.recognize(file);
result(data);
reader.onload = function(e){
input.src = e.target.result;
input.onload = function(){
@ -226,6 +219,11 @@ document.body.addEventListener('drop', async function(e){ @@ -226,6 +219,11 @@ document.body.addEventListener('drop', async function(e){
setUp();
}
}
};
reader.readAsDataURL(file);
await worker.load();
await worker.loadLanguage(language);
await worker.initialize(language);
const { data } = await worker.recognize(file);
result(data);
})

Loading…
Cancel
Save