wasm: support setting Emscripten configuration

Support passing Emscripten configuration options to
the QtLoader constructor using the "moduleConfig"
key.

Previously, it was possible to set Emscripten config options
on the global Module object. However, recent versions
if Qt has switched to using the MODULARIZE=1 build setting,
in which case there is no global object.

Fixes: QTBUG-107979
Pick-to: 6.5
Change-Id: Ie99b772ddbb1d9f5464c868a43c821bae01519e0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Morten Sørvig 2022-12-16 17:24:48 +01:00
parent 9aaf258211
commit a594e95c9a

View File

@ -40,6 +40,8 @@
//
// Config keys
//
// moduleConfig : {}
// Emscripten module configuration
// containerElements : [container-element, ...]
// One or more HTML elements. QtLoader will display loader elements
// on these while loading the application, and replace the loader with a
@ -131,7 +133,7 @@ function _QtLoader(config)
// The Emscripten module and module configuration object. The module
// object is created in completeLoadEmscriptenModule().
self.module = undefined;
self.moduleConfig = {};
self.moduleConfig = config.moduleConfig || {};
// Qt properties. These are propagated to the Emscripten module after
// it has been created.