MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / runtime_evaluate

Function runtime_evaluate

packages/server/src/devtools.rs:1504–1541  ·  view source on GitHub ↗
(query: DevToolsQuery, params: &Value)

Source from the content-addressed store, hash-verified

1502}
1503
1504async fn runtime_evaluate(query: DevToolsQuery, params: &Value) -> Value {
1505 let expression = params
1506 .get("expression")
1507 .and_then(Value::as_str)
1508 .unwrap_or("")
1509 .trim();
1510 if expression.is_empty() {
1511 return json!({ "result": remote_object(&Value::Null) });
1512 }
1513
1514 let hierarchy = match query(
1515 "View.getHierarchy".to_owned(),
1516 json!({
1517 "includeHidden": true,
1518 "maxDepth": 0,
1519 }),
1520 )
1521 .await
1522 {
1523 Ok(value) => value,
1524 Err(error) => return exception_result(error),
1525 };
1526 let Some(root_id) = first_inspector_id(&hierarchy) else {
1527 return exception_result("No inspectable root view is available.".to_owned());
1528 };
1529 match query(
1530 "View.evaluateScript".to_owned(),
1531 json!({
1532 "id": root_id,
1533 "script": expression,
1534 }),
1535 )
1536 .await
1537 {
1538 Ok(value) => json!({ "result": remote_object(value.get("result").unwrap_or(&value)) }),
1539 Err(error) => exception_result(error),
1540 }
1541}
1542
1543fn runtime_get_properties(state: &mut CdpState, params: &Value) -> Value {
1544 let object_id = params

Callers 1

handle_cdp_methodFunction · 0.85

Calls 4

exception_resultFunction · 0.85
first_inspector_idFunction · 0.85
is_emptyMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected