ported new functions

This commit is contained in:
Maccesch 2024-09-02 13:30:01 +01:00
parent d63f4f4b99
commit 1d1fac7065
4 changed files with 14 additions and 14 deletions

View file

@ -135,14 +135,14 @@ use std::rc::Rc;
/// of `default`. /// of `default`.
/// ///
/// ``` /// ```
/// # use leptos::*; /// # use leptos::prelude::*;
/// # use leptos_use::{sync_signal_with_options, SyncSignalOptions}; /// # use leptos_use::{sync_signal_with_options, SyncSignalOptions};
/// # use std::str::FromStr; /// # use std::str::FromStr;
/// # /// #
/// # #[component] /// # #[component]
/// # fn Demo() -> impl IntoView { /// # fn Demo() -> impl IntoView {
/// let (a, set_a) = create_signal("10".to_string()); /// let (a, set_a) = signal("10".to_string());
/// let (b, set_b) = create_signal(2); /// let (b, set_b) = signal(2);
/// ///
/// let stop = sync_signal_with_options( /// let stop = sync_signal_with_options(
/// (a, set_a), /// (a, set_a),
@ -158,7 +158,7 @@ use std::rc::Rc;
/// ``` /// ```
/// ///
/// ``` /// ```
/// # use leptos::*; /// # use leptos::prelude::*;
/// # use leptos_use::{sync_signal_with_options, SyncSignalOptions}; /// # use leptos_use::{sync_signal_with_options, SyncSignalOptions};
/// # use std::str::FromStr; /// # use std::str::FromStr;
/// # /// #
@ -169,8 +169,8 @@ use std::rc::Rc;
/// ///
/// # #[component] /// # #[component]
/// # fn Demo() -> impl IntoView { /// # fn Demo() -> impl IntoView {
/// let (a, set_a) = create_signal(Foo { bar: 10 }); /// let (a, set_a) = signal(Foo { bar: 10 });
/// let (b, set_b) = create_signal(2); /// let (b, set_b) = signal(2);
/// ///
/// let stop = sync_signal_with_options( /// let stop = sync_signal_with_options(
/// (a, set_a), /// (a, set_a),

View file

@ -1,5 +1,5 @@
use crate::core::MaybeRwSignal; use crate::core::MaybeRwSignal;
use leptos::*; use leptos::prelude::*;
/// A boolean switcher with utility functions. /// A boolean switcher with utility functions.
/// ///

View file

@ -21,7 +21,7 @@ pub use web_sys::LockMode;
/// ## Usage /// ## Usage
/// ///
/// ``` /// ```
/// # use leptos::*; /// # use leptos::prelude::*;
/// # use leptos_use::use_web_lock; /// # use leptos_use::use_web_lock;
/// # /// #
/// async fn my_process(_lock: web_sys::Lock) -> i32 { /// async fn my_process(_lock: web_sys::Lock) -> i32 {
@ -31,7 +31,7 @@ pub use web_sys::LockMode;
/// ///
/// # #[component] /// # #[component]
/// # fn Demo() -> impl IntoView { /// # fn Demo() -> impl IntoView {
/// spawn_local(async { /// leptos::spawn::spawn_local(async {
/// let res = use_web_lock("my_lock", my_process).await; /// let res = use_web_lock("my_lock", my_process).await;
/// assert!(matches!(res, Ok(42))); /// assert!(matches!(res, Ok(42)));
/// }); /// });

View file

@ -4,7 +4,7 @@ use crate::{
}; };
use default_struct_builder::DefaultBuilder; use default_struct_builder::DefaultBuilder;
use leptos::ev::resize; use leptos::ev::resize;
use leptos::*; use leptos::prelude::*;
/// Reactive window size. /// Reactive window size.
/// ///
@ -45,8 +45,8 @@ pub fn use_window_size_with_options(options: UseWindowSizeOptions) -> UseWindowS
measure_type, measure_type,
} = options; } = options;
let (width, set_width) = create_signal(initial_size.width); let (width, set_width) = signal(initial_size.width);
let (height, set_height) = create_signal(initial_size.height); let (height, set_height) = signal(initial_size.height);
let update; let update;
@ -126,8 +126,8 @@ pub fn use_window_size_with_options(options: UseWindowSizeOptions) -> UseWindowS
if listen_orientation { if listen_orientation {
let matches = use_media_query("(orientation: portrait)"); let matches = use_media_query("(orientation: portrait)");
create_effect(move |_| { Effect::new(move |_| {
matches.track(); let _ = matches.get();
update(); update();
}); });