| 239 | return exceptionTracker.toResult(std::move(valueFunction)); |
| 240 | } |
| 241 | |
| 242 | static Result<Value> callFunctionSync( |
| 243 | RuntimeWrapper& wrapper, |
| 244 | const std::shared_ptr<snap::valdi_core::JSRuntimeNativeObjectsManager>& nativeObjectsManager, |
| 245 | std::string_view moduleName, |
| 246 | std::string_view functionName, |
| 247 | std::vector<Value> params) { |
| 248 | auto function = |
| 249 | getJsModulePropertyAsUntypedFunction(wrapper.runtime, nativeObjectsManager, moduleName, functionName); |
| 250 | if (!function) { |
| 251 | return function.moveError(); |
| 252 | } |
| 253 | |
| 254 | return function.value()->call(ValueFunctionFlagsCallSync, params.data(), params.size()); |
| 255 | } |
| 256 | |
| 257 | static Result<Value> callFunctionSync(RuntimeWrapper& wrapper, |