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

34 lines
790 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef NATIVE_JSE_H
#define NATIVE_JSE_H
2021-05-18 16:15:28 +08:00
#include "DoricExport.h"
2021-02-04 16:59:58 +08:00
#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-05-18 16:15:28 +08:00
class DORIC_EXPORT DoricNativeJSE : public DoricInterfaceJSE {
2021-02-04 16:59:58 +08:00
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;
2021-04-02 17:23:36 +08:00
void invokeObject(QString objectName, QString functionName,
2021-02-04 16:59:58 +08:00
QVariantList arguments) override;
};
#endif // NATIVE_JSE_H