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/engine/js_engine.h
2019-12-14 10:04:17 +08:00

36 lines
699 B
C++

#ifndef JS_ENGINE_H
#define JS_ENGINE_H
#include <QJSEngine>
#include "native/native_bridge.h"
#include "native/native_empty.h"
#include "native/native_log.h"
#include "native/native_timer.h"
class JSEngine {
public:
QJSEngine *engine = new QJSEngine();
JSEngine();
void prepareContext(int contextId, QString *script);
void destroyContext(int contextId);
private:
NativeLog *nativeLog = new NativeLog();
NativeTimer *nativeTimer = new NativeTimer(engine);
NativeEmpty *nativeEmpty = new NativeEmpty();
NativeBridge *nativeBridge = new NativeBridge();
void initJSEngine();
void injectGlobal();
void initDoricRuntime();
};
#endif // JS_ENGINE_H