mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-02-02 10:54:15 -05:00
ported new functions
This commit is contained in:
parent
d63f4f4b99
commit
1d1fac7065
4 changed files with 14 additions and 14 deletions
|
@ -135,14 +135,14 @@ use std::rc::Rc;
|
|||
/// of `default`.
|
||||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::prelude::*;
|
||||
/// # use leptos_use::{sync_signal_with_options, SyncSignalOptions};
|
||||
/// # use std::str::FromStr;
|
||||
/// #
|
||||
/// # #[component]
|
||||
/// # fn Demo() -> impl IntoView {
|
||||
/// let (a, set_a) = create_signal("10".to_string());
|
||||
/// let (b, set_b) = create_signal(2);
|
||||
/// let (a, set_a) = signal("10".to_string());
|
||||
/// let (b, set_b) = signal(2);
|
||||
///
|
||||
/// let stop = sync_signal_with_options(
|
||||
/// (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 std::str::FromStr;
|
||||
/// #
|
||||
|
@ -169,8 +169,8 @@ use std::rc::Rc;
|
|||
///
|
||||
/// # #[component]
|
||||
/// # fn Demo() -> impl IntoView {
|
||||
/// let (a, set_a) = create_signal(Foo { bar: 10 });
|
||||
/// let (b, set_b) = create_signal(2);
|
||||
/// let (a, set_a) = signal(Foo { bar: 10 });
|
||||
/// let (b, set_b) = signal(2);
|
||||
///
|
||||
/// let stop = sync_signal_with_options(
|
||||
/// (a, set_a),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::core::MaybeRwSignal;
|
||||
use leptos::*;
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// A boolean switcher with utility functions.
|
||||
///
|
||||
|
|
|
@ -21,7 +21,7 @@ pub use web_sys::LockMode;
|
|||
/// ## Usage
|
||||
///
|
||||
/// ```
|
||||
/// # use leptos::*;
|
||||
/// # use leptos::prelude::*;
|
||||
/// # use leptos_use::use_web_lock;
|
||||
/// #
|
||||
/// async fn my_process(_lock: web_sys::Lock) -> i32 {
|
||||
|
@ -31,7 +31,7 @@ pub use web_sys::LockMode;
|
|||
///
|
||||
/// # #[component]
|
||||
/// # fn Demo() -> impl IntoView {
|
||||
/// spawn_local(async {
|
||||
/// leptos::spawn::spawn_local(async {
|
||||
/// let res = use_web_lock("my_lock", my_process).await;
|
||||
/// assert!(matches!(res, Ok(42)));
|
||||
/// });
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
};
|
||||
use default_struct_builder::DefaultBuilder;
|
||||
use leptos::ev::resize;
|
||||
use leptos::*;
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// Reactive window size.
|
||||
///
|
||||
|
@ -45,8 +45,8 @@ pub fn use_window_size_with_options(options: UseWindowSizeOptions) -> UseWindowS
|
|||
measure_type,
|
||||
} = options;
|
||||
|
||||
let (width, set_width) = create_signal(initial_size.width);
|
||||
let (height, set_height) = create_signal(initial_size.height);
|
||||
let (width, set_width) = signal(initial_size.width);
|
||||
let (height, set_height) = signal(initial_size.height);
|
||||
|
||||
let update;
|
||||
|
||||
|
@ -126,8 +126,8 @@ pub fn use_window_size_with_options(options: UseWindowSizeOptions) -> UseWindowS
|
|||
if listen_orientation {
|
||||
let matches = use_media_query("(orientation: portrait)");
|
||||
|
||||
create_effect(move |_| {
|
||||
matches.track();
|
||||
Effect::new(move |_| {
|
||||
let _ = matches.get();
|
||||
|
||||
update();
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue