examples: timer in 0.7

This commit is contained in:
Greg Johnston 2024-05-10 17:19:22 -04:00
parent 274e31018b
commit 3629302f88
2 changed files with 4 additions and 15 deletions

View File

@ -1,10 +1,4 @@
use leptos::{ use leptos::prelude::*;
leptos_dom::helpers::{set_interval_with_handle, IntervalHandle},
prelude::*,
reactive_graph::effect::Effect,
signals::RwSignal,
*,
};
use std::time::Duration; use std::time::Duration;
/// Timer example, demonstrating the use of `use_interval`. /// Timer example, demonstrating the use of `use_interval`.
@ -31,7 +25,7 @@ pub fn TimerDemo() -> impl IntoView {
<div>"Count B (dynamic interval, currently " {interval} " ms)"</div> <div>"Count B (dynamic interval, currently " {interval} " ms)"</div>
<div>{count_b}</div> <div>{count_b}</div>
<input prop:value=interval on:input:target=move |ev| { <input prop:value=interval on:input:target=move |ev| {
if let Ok(value) = ev.target().value().parse::<i32>() { if let Ok(value) = ev.target().value().parse::<u64>() {
interval.set(value); interval.set(value);
} }
}/> }/>

View File

@ -1,12 +1,7 @@
use leptos::*; use leptos::prelude::*;
use timer::TimerDemo; use timer::TimerDemo;
pub fn main() { pub fn main() {
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once(); console_error_panic_hook::set_once();
mount_to_body(|| { mount_to_body(TimerDemo)
view! {
<TimerDemo />
}
})
} }