diff options
| author | Morten Sørvig <morten.sorvig@qt.io> | 2023-06-01 16:24:05 +0200 |
|---|---|---|
| committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2023-07-04 13:42:01 +0000 |
| commit | 64007c749703090ebf7f9b1b49b4267bb9993b99 (patch) | |
| tree | 8ec25500fcb2c5e8f8c6bd98adba6896d4ce7998 /tests/manual/wasm/qtloader_integration/main.cpp | |
| parent | d659c93068120474fb433ad55c619c5d52ab7d8d (diff) | |
wasm: add "preload" qtloader config property
Add support for downloading files from the web server
to the in-memory file system at application load time.
See included documentation for usage.
This preload functionality is different from Emscripten's
--preload-file and --embed-file in that the files are
not packed to a single data file or embedded in the
JavaScript runtime. Instead, the files are downloaded
individually from the web server, which means that they
can be cached individually, and also updated individually
without rebuilding the application.
Any file type can be preloaded. The primary use case
(at the moment) is preloading Qt plugins and QML imports.
Pick-to: 6.6
Task-number: QTBUG-63925
Change-Id: I2b71b0d6a2c12ecd3ec58e319c679cd3f6b16631
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/manual/wasm/qtloader_integration/main.cpp')
| -rw-r--r-- | tests/manual/wasm/qtloader_integration/main.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/manual/wasm/qtloader_integration/main.cpp b/tests/manual/wasm/qtloader_integration/main.cpp index ed8a57bcc6e..b9bed0d49b0 100644 --- a/tests/manual/wasm/qtloader_integration/main.cpp +++ b/tests/manual/wasm/qtloader_integration/main.cpp @@ -49,6 +49,21 @@ std::string logicalDpi() return out.str(); } +std::string preloadedFiles() +{ + QStringList files = QDir("/preload").entryList(QDir::Files); + std::ostringstream out; + out << "["; + const char *separator = ""; + for (const auto &file : files) { + out << separator; + out << file.toStdString(); + separator = ","; + } + out << "]"; + return out.str(); +} + void crash() { std::abort(); @@ -145,6 +160,7 @@ EMSCRIPTEN_BINDINGS(qtLoaderIntegrationTest) emscripten::function("screenInformation", &screenInformation); emscripten::function("logicalDpi", &logicalDpi); + emscripten::function("preloadedFiles", &preloadedFiles); emscripten::function("crash", &crash); emscripten::function("exitApp", &exitApp); emscripten::function("produceOutput", &produceOutput); |
