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);