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

169
Vistas
Blazor Multithreaded Javascript

I am trying to perform two tedious Javascript tasks in parallel with Blazor WebAssembly in .NET 6. My current code looks like this:

task1 = Task.Run(async () =>
{
  try
  {     
    await JSInProcessRuntime.InvokeAsync<int>("BuildTablesOne", new object[] {data1});
  }
  catch (Exception exc)
  {
    await JSInProcessRuntime.InvokeAsync<object>("console.log", exc.Message);
  }
});

task2 = Task.Run(async () =>
{
   try
   {     
      await JSInProcessRuntime.InvokeAsync<int>("BuildTablesTwo", new object[] {data2});
   }
   catch (Exception exc)
   {
      await JSInProcessRuntime.InvokeAsync<object>("console.log", exc.Message);
   }
});

await Task.WhenAll(task1, task2);

These tasks seemingly don't run in parallel as I'd like. I estimate that each of the tasks takes around 2 seconds to finish separately. Totaling 4 seconds of execution time running after each other. In my ideal scenario I would be able to run these both in parallel for a total execution time of 2 seconds. Now I learned that Javascript does not have support for Multithreading but then I also came across WebWorkers and similar concepts and was thinking that maybe Blazor WASM has mechanisms to hook into those new concepts and tools somehow.

Is the above what I am trying to do even achievable, and if yes what can I change in the code to make this fully run in parallel?

about 4 years ago · Juan Pablo Isaza
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