Use the correct way to check for Asyncify

Asyncify is a scoped object within emscripten runtime main function.
Use of EM_JS seems inevitable at this point.

Change-Id: I4852a7054a5e01583139cb54a0e14f604ac8ed13
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Mikolaj Boc 2022-09-23 12:11:04 +02:00
parent 54c959643e
commit c938752bd1

View File

@ -295,7 +295,9 @@ void WebPromiseManager::adoptPromise(emscripten::val target, PromiseCallbacks ca
registerPromise(std::move(allocation), std::move(callbacks));
});
}
} // namespace
EM_JS(bool, jsHaveAsyncify, (), { return typeof Asyncify !== "undefined"; });
} // namespace
ArrayBuffer::ArrayBuffer(uint32_t size)
{
@ -669,7 +671,7 @@ namespace Promise {
bool haveAsyncify()
{
static bool HaveAsyncify = !emscripten::val::global("Asyncify").isUndefined();
static bool HaveAsyncify = jsHaveAsyncify();
return HaveAsyncify;
}