Multithreaded
This commit is contained in:
+11
-2
@@ -5,10 +5,19 @@ use osui::prelude::*;
|
||||
fn main() {
|
||||
let mut cx = Context::new(app);
|
||||
cx.refresh();
|
||||
println!("{:?}", cx.get_nodes());
|
||||
|
||||
std::thread::spawn({
|
||||
let cx = cx.clone();
|
||||
move || {}
|
||||
});
|
||||
|
||||
loop {
|
||||
println!("{:?}", cx.get_nodes());
|
||||
std::thread::sleep(std::time::Duration::from_millis(16));
|
||||
}
|
||||
}
|
||||
|
||||
fn app(cx: &mut Context) -> Vec<Node> {
|
||||
fn app(cx: &Arc<Context>) -> Vec<Node> {
|
||||
let count = use_state(0);
|
||||
|
||||
vec![Node::String(Arc::new(move || format!("{count}")))]
|
||||
|
||||
Reference in New Issue
Block a user