18#include <private/qglobal_p.h>
19#include <QtCore/qglobal.h>
20#include "QtCore/qhash.h"
21#include "QtCore/qiodevice.h"
22#include "QtCore/private/qwasmsuspendresumecontrol_p.h"
24#include <emscripten/val.h>
28#include <initializer_list>
34#include <emscripten/proxying.h>
35#include <emscripten/threading.h>
38#if QT_CONFIG(wasm_jspi)
39# define QT_WASM_EMSCRIPTEN_ASYNC ,emscripten::async()
41# define QT_WASM_EMSCRIPTEN_ASYNC
219 template<
typename... Args>
220 void make(emscripten::val target,
225 emscripten::val promiseObject = target.call<emscripten::val>(
226 methodName.toStdString().c_str(), std::forward<Args>(args)...);
227 if (promiseObject.isUndefined() || promiseObject[
"constructor"][
"name"].as<
std::string>() !=
"Promise") {
228 qFatal(
"This function did not return a promise");
231 adoptPromise(
std::move(promiseObject),
std::move(callbacks));
240 return wrappedCallback;
264 bool open(QIODevice::OpenMode mode)
override;
267 bool seek(qint64 pos)
override;
279 static emscripten::val savedWindow = emscripten::val::global(
"window");
qint64 size() const override
For open random-access devices, this function returns the size of the device.
bool seek(qint64 pos) override
For random-access devices, this function sets the current position to pos, returning true on success,...
Uint8ArrayIODevice(Uint8Array array)
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
qint64 writeData(const char *data, qint64 size) override
Writes up to maxSize bytes from data to the device.
bool open(QIODevice::OpenMode mode) override
qint64 readData(char *data, qint64 maxSize) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
void make(emscripten::val target, QString methodName, PromiseCallbacks callbacks, Args... args)
bool canBlockCallingThread()
const char makeContextfulPromiseFunctionName[]
static void usePotentialyUnusedSymbols()
decltype(auto) bindForever(F wrappedCallback)
std::function< void(emscripten::val)> thenFunc
std::function< void()> finallyFunc
std::function< void(emscripten::val)> catchFunc