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/DoricNativeJSE.h

32 lines
755 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef NATIVE_JSE_H
#define NATIVE_JSE_H
#include "DoricInterfaceJSE.h"
2021-04-02 15:16:18 +08:00
#include "native/NativeExecutor.h"
2021-03-31 10:36:45 +08:00
#include "v8/V8Executor.h"
2021-02-04 16:59:58 +08:00
2021-04-02 15:16:18 +08:00
enum class JSEType { V8, Native };
2021-02-04 16:59:58 +08:00
class DoricNativeJSE : public DoricInterfaceJSE {
private:
2021-04-02 15:16:18 +08:00
JSEType mType;
2021-03-31 10:36:45 +08:00
V8Executor *v8Executor;
2021-04-02 15:16:18 +08:00
NativeExecutor *nativeExecutor;
2021-02-04 16:59:58 +08:00
public:
2021-04-02 15:16:18 +08:00
DoricNativeJSE(JSEType type);
2021-02-04 16:59:58 +08:00
QString loadJS(QString script, QString source) override;
void injectGlobalJSObject(QString name, QObject *object) override;
void injectGlobalJSFunction(QString name, QObject *function,
QString property) override;
QJSValue invokeObject(QString objectName, QString functionName,
QVariantList arguments) override;
};
#endif // NATIVE_JSE_H