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

39 lines
872 B
C
Raw Permalink Normal View History

2021-02-04 16:59:58 +08:00
#ifndef JSENGINE_H
#define JSENGINE_H
#include <QJSValue>
#include <QThreadPool>
2021-05-18 16:15:28 +08:00
#include "DoricExport.h"
2021-02-04 16:59:58 +08:00
#include "../DoricRegistry.h"
#include "DoricInterfaceJSE.h"
2021-05-18 16:15:28 +08:00
class DORIC_EXPORT DoricJSEngine : public QObject {
2021-02-04 16:59:58 +08:00
Q_OBJECT
private:
DoricInterfaceJSE *mJSE;
2021-05-17 16:18:44 +08:00
DoricRegistry *mRegistry = DoricRegistry::getInstance();
2021-02-04 16:59:58 +08:00
void loadBuiltinJS(QString assetName);
QString packageContextScript(QString contextId, QString content);
QString packageModuleScript(QString moduleName, QString content);
public:
QThreadPool mJSThreadPool;
explicit DoricJSEngine(QObject *parent = nullptr);
~DoricJSEngine();
2021-05-25 10:45:45 +08:00
QString prepareContext(QString contextId, QString script, QString source);
2021-04-09 16:39:43 +08:00
2021-05-25 10:45:45 +08:00
QString destroyContext(QString contextId);
2021-04-09 16:39:43 +08:00
2021-05-25 10:45:45 +08:00
QString invokeDoricMethod(QString method, QVariantList arguments);
2021-04-09 16:39:43 +08:00
2021-02-04 16:59:58 +08:00
DoricRegistry *getRegistry();
};
#endif // JSENGINE_H