This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/engine/DoricPromise.h
2021-05-20 18:27:45 +08:00

37 lines
992 B
C++

#ifndef DORICPROMISE_H
#define DORICPROMISE_H
#include <QDebug>
#include "DoricContext.h"
#include "utils/DoricConstant.h"
class DoricPromise {
public:
static void resolve(DoricContext *context, QString callbackId,
QVariantList args) {
QVariantList params;
params.append(context->getContextId());
params.append(callbackId);
foreach (QVariant arg, args) { params.append(arg); }
context->getDriver()->invokeDoricMethod(DoricConstant::DORIC_BRIDGE_RESOLVE,
params);
}
static void reject(DoricContext *context, QString callbackId,
QVariantList args) {
QVariantList params;
params.append(context->getContextId());
params.append(callbackId);
foreach (QVariant arg, args) { params.append(arg); }
context->getDriver()->invokeDoricMethod(DoricConstant::DORIC_BRIDGE_REJECT,
params);
}
};
#endif // DORICPROMISE_H