diff --git a/src/use_scroll.rs b/src/use_scroll.rs new file mode 100644 index 0000000..ecd2ae4 --- /dev/null +++ b/src/use_scroll.rs @@ -0,0 +1,28 @@ +use crate::use_event_listener; +use leptos::*; + +pub struct UseScrollOptions { + /// Throttle time in milliseconds for the scroll events. Defaults to 0 (disabled). + pub throttle: u32, + + /// After scrolling ends we wait idle + throttle milliseconds before we consider scrolling to have stopped. + /// Defaults to 200. + pub idle: u32, +} + +pub struct UseScrollReturn { + pub x: ReadSignal, + pub setX: WriteSignal, + pub y: ReadSignal, + pub setY: WriteSignal, + pub isScrolling: ReadSignal, + pub arrivedState: ReadSignal, + pub directions: ReadSignal, +} + +pub struct Directions { + pub left: bool, + pub right: bool, + pub top: bool, + pub bottom: bool, +}