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 <[email protected]> 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. > > Thanks > > Mehdi > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/978f8d00-0cf1-4dec-bbe5-b9c7b20a1a61%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/978f8d00-0cf1-4dec-bbe5-b9c7b20a1a61%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTkrDRFkrnvNNR2D_N5qe%3D3YRuORLsL9WNHN%2Bezbhqiicw%40mail.gmail.com.
