Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
FileSystemDirectoryReader.readEntries: Is there a way to read files from folder sync?

FileSystemDirectoryReader.readEntries lets us read the file contents however is it is async in nature and I need to do it in a synchronous way. I have tried using async and that doesn't fit my use case as well. What I want is somewhat similiar to this. Which freezes the main thread.

var request = new XMLHttpRequest();
request.open('GET', '/bar/foo.txt', false);  // `false` makes the request synchronous
request.send(null);

if (request.status === 200) {
  console.log(request.responseText);
}

I know it is bad user experience but it seems unavoidable at this point.

The use case

We have multiple event handlers listening to the drop event. I need to so some processing in my event handler (It's guaranteed to be the first one to receive) based on which I can decide whether the other event handlers should not process the event using event.stopImmediatePropagation but if I am doing stuff which is async the other handlers receive and continue to process the event even if I decide to stop propagation. I have no control over the other handlers and cant modify their code

I have tried stopping the propagation before my async call and dispatch the event after processing but that is proving to be difficult as the event.dataTransfer is empty and the other event handlers are not getting the files. Force setting the dataTransfer results in isTrusted being set to false for the event

Javascript DataTransfer items not persisting through async calls

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda