6 class JSResult : public QObject {
10 JSResult(QObject *parent = nullptr) : QObject(parent) {}
11 ~JSResult() { qDebug() << "Destroying result"; }
13 template <typename Functor> JSResult &onString(Functor lambda) {
14 connect(this, &JSResult::string, this, lambda);
17 template <typename Functor> JSResult &onJson(Functor lambda) {
18 connect(this, &JSResult::json, this, lambda);
21 template <typename Functor> JSResult &onError(Functor lambda) {
22 connect(this, &JSResult::error, this, lambda);
26 Q_INVOKABLE QJSValue setData(QJSValue value);
27 Q_INVOKABLE QJSValue setError(QJSValue value);
30 void json(const QJsonDocument &doc);
31 void string(const QString &data);
32 void error(const QString &message);