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::{
leptos_dom::helpers::{set_interval_with_handle, IntervalHandle},
prelude::*,
reactive_graph::effect::Effect,
signals::RwSignal,
*,
};
use leptos::prelude::*;
use std::time::Duration;
/// 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}</div>
<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);
}
}/>

View File

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