From 2161f776e840f7d72113cc966d090f9d1b536b20 Mon Sep 17 00:00:00 2001 From: Maccesch Date: Thu, 27 Jul 2023 23:53:26 +0100 Subject: [PATCH] added examples for signal_... --- examples/signal_debounced/src/main.rs | 27 ++++++++++++++++++++++++--- examples/signal_throttled/src/main.rs | 27 ++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/examples/signal_debounced/src/main.rs b/examples/signal_debounced/src/main.rs index ae29c3d..9b1ab14 100644 --- a/examples/signal_debounced/src/main.rs +++ b/examples/signal_debounced/src/main.rs @@ -1,12 +1,33 @@ use leptos::*; -use leptos_use::docs::demo_or_body; +use leptos_use::docs::{demo_or_body, Note}; use leptos_use::signal_debounced; #[component] fn Demo() -> impl IntoView { - // signal_debounced(); + let (input, set_input) = create_signal("".to_string()); + let debounced = signal_debounced(input, 1000.0); - view! {} + view! { +
+ + + Delay is set to 1000ms for this demo. + +

+ Input signal: + {input} +

+

+ Debounced signal: + {debounced} +

+
+ } } fn main() { diff --git a/examples/signal_throttled/src/main.rs b/examples/signal_throttled/src/main.rs index 2003396..0fc43ac 100644 --- a/examples/signal_throttled/src/main.rs +++ b/examples/signal_throttled/src/main.rs @@ -1,12 +1,33 @@ use leptos::*; -use leptos_use::docs::demo_or_body; +use leptos_use::docs::{demo_or_body, Note}; use leptos_use::signal_throttled; #[component] fn Demo() -> impl IntoView { - // signal_throttled(); + let (input, set_input) = create_signal("".to_string()); + let throttled = signal_throttled(input, 1000.0); - view! {} + view! { +
+ + + Delay is set to 1000ms for this demo. + +

+ Input signal: + {input} +

+

+ Throttled signal: + {throttled} +

+
+ } } fn main() {