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

37 lines
815 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef JSENGINE_H
#define JSENGINE_H
#include <QJSValue>
#include <QThreadPool>
#include "../DoricRegistry.h"
#include "DoricInterfaceJSE.h"
class DoricJSEngine : public QObject {
Q_OBJECT
private:
DoricInterfaceJSE *mJSE;
DoricRegistry *mRegistry = new DoricRegistry();
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();
void prepareContext(QString contextId, QString script, QString source);
2021-04-09 16:39:43 +08:00
void destroyContext(QString contextId);
2021-04-02 17:23:36 +08:00
void 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