Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!