2022-03-19 03:11:30 +01:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2022-07-09 15:15:20 -04:00
|
|
|
dioxus_desktop::launch(app);
|
2022-03-19 03:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
|
|
|
let script = use_state(&cx, String::new);
|
2022-07-09 15:15:20 -04:00
|
|
|
let eval = dioxus_desktop::use_eval(&cx);
|
2022-03-19 03:11:30 +01:00
|
|
|
|
|
|
|
cx.render(rsx! {
|
|
|
|
div {
|
|
|
|
input {
|
|
|
|
placeholder: "Enter an expression",
|
|
|
|
value: "{script}",
|
|
|
|
oninput: move |e| script.set(e.value.clone()),
|
|
|
|
}
|
|
|
|
button {
|
2022-11-15 20:58:56 -08:00
|
|
|
onclick: move |_| eval(script.to_string()),
|
2022-03-19 03:11:30 +01:00
|
|
|
"Execute"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|