| 8 | BridgeEvent::~BridgeEvent() {} |
| 9 | |
| 10 | void BridgeEvent::reg(const QString &event, const QString &type, const QJSValue &handler, const QJSValue &agents, const QJSValue &os, const QJSValue &listeners, const QString &event_id) |
| 11 | { |
| 12 | if (!handler.isCallable()) { |
| 13 | Q_EMIT scriptError(type + " -> handler is not Callable"); |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | if (!AxScriptUtils::isValidNonEmptyArray(agents)) { |
| 18 | Q_EMIT scriptError(type + " -> agents is undefined or empty"); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | QSet<QString> list_agents = AxScriptUtils::jsArrayToStringSet(agents); |
| 23 | QSet<QString> list_os = AxScriptUtils::jsArrayToStringSet(os); |
| 24 | QSet<QString> list_listeners = AxScriptUtils::jsArrayToStringSet(listeners); |
| 25 | |
| 26 | this->scriptEngine->registerEvent(event, handler, nullptr, list_agents, list_os, list_listeners, event_id); |
| 27 | } |
| 28 | |
| 29 | |
| 30 |
no test coverage detected