chore: clean up clock
This commit is contained in:
1 parent
daa5449b6b
commit
ba20bc08b8
2 files changed
+3
-6
No files matched your search
+3
-4
@@ -3,16 +3,15 @@
|
|||||||
//! The example from the README.md.
|
//! The example from the README.md.
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use futures_util::Future;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus_desktop::launch(app);
|
dioxus_desktop::launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let mut count = use_ref(cx, || 0);
|
let count = use_ref(cx, || 0);
|
||||||
|
|
||||||
let mut ct = count.to_owned();
|
let ct = count.to_owned();
|
||||||
use_coroutine(cx, |_: UnboundedReceiver<()>| async move {
|
use_coroutine(cx, |_: UnboundedReceiver<()>| async move {
|
||||||
loop {
|
loop {
|
||||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||||
@@ -25,7 +24,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut count = count.read();
|
let count = count.read();
|
||||||
|
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
div { "High-Five counter: {count}" }
|
div { "High-Five counter: {count}" }
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ pub struct LocalTaskHandle {
|
|||||||
|
|
||||||
impl ArcWake for LocalTaskHandle {
|
impl ArcWake for LocalTaskHandle {
|
||||||
fn wake_by_ref(arc_self: &Arc<Self>) {
|
fn wake_by_ref(arc_self: &Arc<Self>) {
|
||||||
println!("waking task: {:?} {:p}", arc_self.id, arc_self);
|
|
||||||
|
|
||||||
arc_self
|
arc_self
|
||||||
.tx
|
.tx
|
||||||
.unbounded_send(SchedulerMsg::TaskNotified(arc_self.id))
|
.unbounded_send(SchedulerMsg::TaskNotified(arc_self.id))
|
||||||
|
|||||||
Reference in new issue
Block a user