Crate leptos_use
source ·Expand description
Collection of essential Leptos utilities inspired by SolidJS USE / VueUse
Re-exports
pub use crate::utils::DebounceOptions;
pub use crate::utils::ThrottleOptions;
Modules
Structs
- Threshold in pixels when we consider a side to have arrived (
UseScrollReturn::arrived_state
). - Return type of
use_mouse
. - Options for
use_scroll
. - The return value of
use_scroll
.
Enums
- The scroll behavior. Can be
Auto
(= not smooth) orSmooth
. Defaults toAuto
. - Defines how to get the coordinates from the event.
- Identifies the source of the reported coordinates
Traits
- Trait to implement if you want to specify a custom extractor
Functions
- Debounce execution of a function.
- Version of
use_debounce_fn
with an argument for the debounced function. See the docs foruse_debounce_fn
for how to use. - Version of
use_debounce_fn_with_arg
with debounce options. - Version of
use_debounce_fn
with debounce options. See the docs foruse_debounce_fn
for how to use. - Use EventListener with ease. Register using addEventListener on mounted, and removeEventListener automatically on cleanup.
- Version of
use_event_listener
that takesweb_sys::AddEventListenerOptions
. See the docs foruse_event_listener
for how to use. - Reactive mouse position
- Reactive scroll position and state.
- Version of
use_scroll
with options. Seeuse_scroll
for how to use. - SSR compatibe
is_supported
- Throttle execution of a function. Especially useful for rate limiting execution of handlers on events like resize and scroll.
- Version of
use_throttle_fn
with an argument for the throttled function. See the docs foruse_throttle_fn
for how to use. - Version of
use_throttle_fn_with_arg
with throttle options. See the docs foruse_throttle_fn
for how to use. - Version of
use_throttle_fn
with throttle options. See the docs foruse_throttle_fn
for how to use. - A version of
create_effect
that listens to any dependency that is accessed insidedeps
. Also a stop handler is returned. Ifimmediate
is false, thecallback
will not run immediately but only after the first change is detected of any signal that is accessed indeps
. The return value ofdeps
is passed intocallback
as an argument together with the previous value and the previous value that thecallback
itself returned last time.