| 1362 | } |
| 1363 | |
| 1364 | JSValueRef JavaScriptRuntime::handleViewNodeSpecificActionSync(JSFunctionNativeCallContext& callContext, |
| 1365 | Value (*handleViewNode)(ViewNode&)) { |
| 1366 | return handleViewNodeSpecificAction( |
| 1367 | callContext, |
| 1368 | [handleViewNode](ViewNode& viewNode, |
| 1369 | Function<void(const Value&)> callback) { // NOLINT(performance-unnecessary-value-param) |
| 1370 | callback(handleViewNode(viewNode)); |
| 1371 | }); |
| 1372 | } |
| 1373 | |
| 1374 | JSValueRef JavaScriptRuntime::handleViewNodeSpecificActionAsync(JSFunctionNativeCallContext& callContext, |
| 1375 | void (*handleViewNode)(ViewNode&, |
| 1376 | Function<void(const Value&)>)) { |
| 1377 | return handleViewNodeSpecificAction(callContext, |
| 1378 | [handleViewNode](ViewNode& viewNode, Function<void(const Value&)> callback) { |
| 1379 | handleViewNode(viewNode, std::move(callback)); |
| 1380 | }); |
| 1381 | } |
| 1382 | |
| 1383 | // NOLINTNEXTLINE(readability-convert-member-functions-to-static) |
| 1384 | JSValueRef JavaScriptRuntime::runtimeMakeOpaque(JSFunctionNativeCallContext& callContext) { |
| 1385 | return makeOpaque(callContext.getContext(), |
| 1386 | callContext.getParameter(0), |
| 1387 | ReferenceInfoBuilder(callContext.getReferenceInfo()).withReturnValue(), |
| 1388 | callContext.getExceptionTracker()); |
| 1389 | } |
| 1390 | |
| 1391 | // NOLINTNEXTLINE(readability-convert-member-functions-to-static) |
| 1392 | JSValueRef JavaScriptRuntime::runtimeBytesToString(JSFunctionNativeCallContext& callContext) { |
| 1393 | auto convertedBytes = |
| 1394 | callContext.getContext().valueToTypedArray(callContext.getParameter(0), callContext.getExceptionTracker()); |
| 1395 | CHECK_CALL_CONTEXT(callContext); |
| 1396 | |
| 1397 | return callContext.getContext().newStringUTF8( |
| 1398 | std::string_view(reinterpret_cast<const char*>(convertedBytes.data), convertedBytes.length), |
| 1399 | callContext.getExceptionTracker()); |
| 1400 | } |
| 1401 | |
| 1402 | JSValueRef JavaScriptRuntime::runtimeIsModuleLoaded(JSFunctionNativeCallContext& callContext) { |
| 1403 | auto moduleName = callContext.getParameterAsString(0); |
| 1404 | CHECK_CALL_CONTEXT(callContext); |
| 1405 | |
| 1406 | auto moduleLoaded = _resourceManager.isBundleLoaded(moduleName); |
| 1407 | return callContext.getContext().newBool(moduleLoaded); |
| 1408 | } |
| 1409 | |
| 1410 | JSValueRef JavaScriptRuntime::runtimeGetModuleEntry(JSFunctionNativeCallContext& callContext) { |
| 1411 | auto moduleName = callContext.getParameterAsString(0); |
| 1412 | CHECK_CALL_CONTEXT(callContext); |
| 1413 | |
| 1414 | auto path = callContext.getParameterAsString(1); |
| 1415 | CHECK_CALL_CONTEXT(callContext); |
| 1416 | |
| 1417 | auto asString = callContext.getParameterAsBool(2); |
| 1418 | CHECK_CALL_CONTEXT(callContext); |
| 1419 | |
| 1420 | auto bundle = _resourceManager.getBundle(moduleName); |
| 1421 |
nothing calls this directly
no test coverage detected