feat: make the interpreter as its own crate

This commit is contained in:
Jonathan Kelley committed 2022-02-01 15:44:08 -05:00
1 parent ee67a041d2
commit 527434b9f9
8 files changed
+20 -557

No files matched your search

+4 -4
View File
@@ -10,14 +10,14 @@ fn main() {
}
fn app(cx: Scope) -> Element {
let count = use_state(&cx, || 0);
let (count, set_count) = use_state(&cx, || 0);
use_future(&cx, || {
let count = count.for_async();
let set_count = set_count.clone();
async move {
loop {
tokio::time::sleep(Duration::from_millis(1000)).await;
*count.modify() += 1;
set_count.modify(|f| f + 1)
}
}
});
@@ -26,7 +26,7 @@ fn app(cx: Scope) -> Element {
div {
h1 { "High-Five counter: {count}" }
button {
onclick: move |_| count.set(0),
onclick: move |_| set_count(0),
"Click me!"
}
}