First time looking into Asyncify again. Impressed with the improvements
since I last looked into it!
One question: I am calling some exported top-level function that may or may
not call some nested asynchronous function. If it does, then waiting on the
promise returned by `Asyncify.whenDone()` gives me the function's result.
If the top-level function does not call the nested asynchronous function,
then its result is synchronously returned.
The only way for me to know whether or not I need to wait on
`Asyncify.whenDone()` is to check whether `Asyncify.currData === null`.
Is this how it is supposed to be? So something like:
```
async function callExportedFunction() {
const syncResult = Module.topLevelFunction();
if (Asyncify.currData === null) return syncResult;
return Asyncify.whenDone();
}
```
This works, but seems inconsistent and unnecessarily complex. Could the
exported function always directly return a promise? Or at least, can
`Asyncify.whenDone()` resolve immediately when the result is synchronously
available?
Soeren
--
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/04239424-7ad4-491b-b94a-20c2f0bcce22n%40googlegroups.com.