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

216
Vistas
How to handle promise when calling async JS method from C++ using Emscripten

I have an async JS method something like

async Add(_a: number, _b: number): Promise<number> {
    return _a + _b
}

window.Add = Add

Normally if I call this function from JS, I would do something like

Add(5, 5).then((_result) => {
    console.log(_result)
}).catch((error) => {
    console.log(error)
})

How can I achieve this same behavior of handling the promise when calling this JS async function from C++?

Currently, I am doing something like this to call the JS function from C++

emscripten::val::global("Add").operator()(5, 5);
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