pub fn start_bridge(
port: u16,
app_name: impl Into<String>,
) -> Receiver<EvalCommand>Expand description
Start the inspector HTTP bridge.
Returns a receiver that your Dioxus app should poll to execute JavaScript.
The bridge listens on 127.0.0.1:{port}.
§Example
ⓘ
let mut eval_rx = start_bridge(9999, "my-app");
spawn(async move {
while let Some(cmd) = eval_rx.recv().await {
let result = document::eval(&cmd.script).await;
let response = match result {
Ok(val) => EvalResponse::success(val.to_string()),
Err(e) => EvalResponse::error(e.to_string()),
};
let _ = cmd.response_tx.send(response);
}
});