MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / initEngine

Method initEngine

src/app/script/app_scripting.cpp:158–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 void AppScripting::initEngine() {
159 if (!wasInit) {
160 wasInit = true;
161 App::instance()->Exit.connect([]{
162 engine = nullptr;
163 });
164 }
165
166 // if there is no engine OR
167 // the engine we have doesn't match the default in the registry,
168 // inject a new one
169 if (!engine || !script::Engine::getRegistry()[""].match(engine.get())) {
170 bool printLast = engine && engine->getPrintLastResult();
171 engine = inject<script::Engine>();
172 if (engine && printLast)
173 engine->getPrintLastResult();
174 }
175 }
176
177 void AppScripting::raiseEvent(const std::string& fileName, const std::vector<script::Value> &event) {
178 TaskManager::instance().delayed([=]{

Callers

nothing calls this directly

Calls 4

instanceFunction · 0.85
matchMethod · 0.80
getPrintLastResultMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected