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/js_engine.h
2021-05-20 18:27:45 +08:00

33 lines
753 B
C++

#ifndef JSENGINE_H
#define JSENGINE_H
#include <QJSValue>
#include <QThreadPool>
#include "interface_jse.h"
#include "../registry.h"
class JSEngine : public QObject
{
Q_OBJECT
private:
InterfaceJSE *mJSE;
Registry *mRegistry = new Registry();
void loadBuiltinJS(QString assetName);
QString packageContextScript(QString contextId, QString content);
QString packageModuleScript(QString moduleName, QString content);
public:
QThreadPool mJSThreadPool;
explicit JSEngine(QObject *parent = nullptr);
~JSEngine();
void prepareContext(QString contextId, QString script, QString source);
QJSValue invokeDoricMethod(QString method, QVariantList arguments);
Registry *getRegistry();
};
#endif // JSENGINE_H