a javascript function like this:
async function getData(){
//do something and return a string
}
my_module.set_js_func(getData);
my c++ emscripten code like this:
//bind c++ function
EMSCRIPTEN_BINDINGS(my_module) {
function("setJSFunction", &set_js_func);
//...
emscripten::val func2;
void set_js_func(emscripten::val func)
{
func2 = func;
//call function directly here or inside a timer loop
func2();
}
my question is:
i wanna to call getData ( in c++ ) like this:
await getData();
but i only know call it like this in above example code:
func2();
anyone can help me to give some advice ?
i am using emscripten 1.38.31