Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
I'm trying to write an asynchronous pathfinding function using async await in javascript

I'm testing if it works and a function that runs a while loop will block the code even if it is in an asynchronous function that I am awaiting. How do do something like pathfinding without freezing my webpage?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Doing work keeps the main JS event loop busy.

You can't get around that by using promises or the async and await tools. They are tools to manage asynchronous code, they don't make code asynchronous.

A couple of strategies you could employ are:

  • Moving the work off the main event loop and into a Web Worker.
  • Doing the work in chunks with chunk 𝑛 triggering the processing of chunk 𝑛+1 using setTimeout to introduce a delay during which the main event loop can pick up other work that is waiting for it.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda