--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/978f8d00-0cf1-4dec-bbe5-b9c7b20a1a61%40googlegroups.com.
createAudioFileAsync(audioSettings).then(successCallback);
Are you trying to create a C++ function that schedules work asynchronously and synchronously returns a Promise which can be used by JS code to wait on and retrieve a value?This should be possible through emscripten::val by translating the equivalent code from JS to val invocations, though I've not tested it... You'd still need to use emscripten_async_call unless there's some other way you intend to schedule the work to happen after the call, such as manual use of setTimeout via val or some other callback.-- brion
On Mon, Nov 25, 2019 at 10:03 AM Mehdi Sabwat <mehdi...@gmail.com> wrote:
--Hi,I have been looking for a way to resolve a Promise using emscripten::val, is that possible? if not, would it be possible in C/C++ without wrapping it in an EM_ASM?I have been thinking about Atomics.wait, but I am not sure it is the best way because it is limited to Int32Array. For now, I am using emscripten_async_call(), it would be great if I could replace it with something less hacky.ThanksMehdi
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
// I can get result["whatever"], or add parameters, depending on the expected callback
void print(val result)
{
std::cout << "Hi there..." << "\n";
}
int main()
{
val prom
promise.call<void>("then", val::module_property("Zecallback"));
return 0;
}
EMSCRIPTEN_BINDINGS(name) {
function("Zecallback", &print);
}
couldn't reproduce the bug though, will post it when it pops back.