diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 7ae29e616d..cd7d3583b4 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -32,6 +32,8 @@ Q_LOGGING_CATEGORY(lcEventDispatcherTimers, "qt.eventdispatcher.timers"); // track Qts own usage of asyncify. static bool g_is_asyncify_suspended = false; +#if defined(QT_STATIC) + EM_JS(bool, qt_have_asyncify_js, (), { return typeof Asyncify != "undefined"; }); @@ -54,6 +56,27 @@ EM_JS(void, qt_asyncify_resume_js, (), { setTimeout(wakeUp); }); +#else + +// EM_JS is not supported for side modules; disable asyncify + +bool qt_have_asyncify_js() +{ + return false; +} + +void qt_asyncify_suspend_js() +{ + Q_UNREACHABLE(); +} + +void qt_asyncify_resume_js() +{ + Q_UNREACHABLE(); +} + +#endif // defined(QT_STATIC) + // Returns true if asyncify is available. bool qt_have_asyncify() {