| 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([=]{ |
nothing calls this directly
no test coverage detected