Copyright | (C) 2016-2025 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.Lynx.Element.List.Event
Description
Synopsis
- onScroll :: (ScrollEvent -> action) -> Attribute action
- onScrollToUpper :: (ScrollEvent -> action) -> Attribute action
- onScrollToLower :: (ScrollEvent -> action) -> Attribute action
- onScrollStateChange :: (ScrollStateChange -> action) -> Attribute action
- onLayoutComplete :: (LayoutCompleteEvent -> action) -> Attribute action
- onSnap :: (SnapEvent -> action) -> Attribute action
- data ScrollEvent = ScrollEvent {
- deltaX :: Double
- deltaY :: Double
- scrollLeft :: Double
- scrollTop :: Double
- scrollWidth :: Double
- scrollHeight :: Double
- listWidth :: Double
- listHeight :: Double
- listEventSource :: ListEventSource
- attachedCells :: [Cell]
- data SnapEvent = SnapEvent {}
- data LayoutCompleteEvent = LayoutCompleteEvent {
- layoutId :: Double
- scrollInfo :: ScrollEvent
- diffResult :: Maybe DiffResult
- visibleCellsAfterUpdate :: [ListItemInfo]
- visibleCellsBeforeUpdate :: [ListItemInfo]
- data DiffResult = DiffResult {}
- data ListEventSource
- data Cell = Cell {
- cellId :: Double
- cellItemKey :: MisoString
- cellIndex :: Double
- cellLeft :: Double
- cellTop :: Double
- cellRight :: Double
- cellBottom :: Double
- data ScrollStateChange
- scrollDecoder :: Decoder ScrollEvent
- snapDecoder :: Decoder SnapEvent
- layoutCompleteDecoder :: Decoder LayoutCompleteEvent
- listEvents :: Events
Event
onScroll :: (ScrollEvent -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#scroll
<list> scroll event.
data Action = HandleScroll ScrollEvent view :: Model -> View Action view model = list_ defaultListOptions [ onScroll HandleScroll ] [ ] update :: Action -> Effect Model Action update (HandleScroll ScrollEvent {..}) = io_ (consoleLog "handled scroll event")
onScrollToUpper :: (ScrollEvent -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrolltoupper
Callback triggered when scrolling to the top of <list>. The trigger
position of this callback can be controlled by upperThresholdItemCount
.
data Action = HandleScroll ScrollEvent view :: Model -> View Action view model = list_ defaultListOptions [ onScrollToUpper HandleScroll ] [ ] update :: Action -> Effect Model Action update (HandleScroll ScrollEvent {..}) = io_ (consoleLog "handled scroll event")
onScrollToLower :: (ScrollEvent -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrolltolower
Callback triggered when scrolling to the bottom of <list>. The trigger
position of this callback can be controlled by lowerThresholdItemCount_
data Action = HandleScroll ScrollEvent view :: Model -> View Action view model = list_ defaultListOptions [ onScrollToLower HandleScroll ] [ ] update :: Action -> Effect Model Action update (HandleScroll ScrollEvent {..}) = io_ (consoleLog "handled scroll event")
onScrollStateChange :: (ScrollStateChange -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrollstatechange
Callback triggered when the scroll state of <list> changes. The state field in the event parameter's detail indicates the scroll state: * 1 for stationary * 2 for dragging * 3 for inertial scrolling * 4 for smooth animation scrolling.
data Action = HandleScrollState ScrollStateChange view :: Model -> View Action view model = list_ defaultListOptions [ onScrollStateChange HandleScrollState ] [ ] update :: Action -> Effect Model Action update (HandleScroll Stationary) = io_ (consoleLog "Received Stationary scroll state change") update _ = pure ()
onLayoutComplete :: (LayoutCompleteEvent -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#layoutcomplete
Callback triggered after <list> layout is complete.
data Action = HandleLayout LayoutCompleteEvent view :: Model -> View Action view model = list_ defaultListOptions [ onLayoutComplete HandleLayout ] [ ] update :: Action -> Effect Model Action update (HandleLayout LayoutCompleteEvent {..}) = io_ (consoleLog "Received LayoutCompleteEvent")
onSnap :: (SnapEvent -> action) -> Attribute action Source #
https://lynxjs.org/api/elements/built-in/list.html#snap
Callback when pagination scrolling is about to occur.
data Action = HandleSnap SnapEvent view :: Model -> View Action view model = list_ defaultListOptions [ onSnap HandleSnap ] [ ] update :: Action -> Effect Model Action update (HandleSnap SnapEvent {..}) = io_ (consoleLog "Received SnapEvent")
Types
data ScrollEvent Source #
Constructors
ScrollEvent | |
Fields
|
Instances
FromJSON ScrollEvent Source # | |
Defined in Miso.Lynx.Element.List.Event Methods parseJSON :: Value -> Parser ScrollEvent Source # parseJSONList :: Value -> Parser [ScrollEvent] Source # | |
Show ScrollEvent Source # | |
Defined in Miso.Lynx.Element.List.Event Methods showsPrec :: Int -> ScrollEvent -> ShowS # show :: ScrollEvent -> String # showList :: [ScrollEvent] -> ShowS # | |
Eq ScrollEvent Source # | |
Defined in Miso.Lynx.Element.List.Event |
Constructors
SnapEvent | |
Fields
|
data LayoutCompleteEvent Source #
https://lynxjs.org/api/elements/built-in/list.html#layoutcomplete
Enable needLayoutCompleteInfo
to use.
Constructors
LayoutCompleteEvent | |
Fields
|
Instances
Show LayoutCompleteEvent Source # | |
Defined in Miso.Lynx.Element.List.Event Methods showsPrec :: Int -> LayoutCompleteEvent -> ShowS # show :: LayoutCompleteEvent -> String # showList :: [LayoutCompleteEvent] -> ShowS # | |
Eq LayoutCompleteEvent Source # | |
Defined in Miso.Lynx.Element.List.Event Methods (==) :: LayoutCompleteEvent -> LayoutCompleteEvent -> Bool # (/=) :: LayoutCompleteEvent -> LayoutCompleteEvent -> Bool # |
data DiffResult Source #
Constructors
DiffResult | |
Instances
FromJSON DiffResult Source # | |
Defined in Miso.Lynx.Element.List.Event Methods parseJSON :: Value -> Parser DiffResult Source # parseJSONList :: Value -> Parser [DiffResult] Source # | |
Show DiffResult Source # | |
Defined in Miso.Lynx.Element.List.Event Methods showsPrec :: Int -> DiffResult -> ShowS # show :: DiffResult -> String # showList :: [DiffResult] -> ShowS # | |
Eq DiffResult Source # | |
Defined in Miso.Lynx.Element.List.Event |
data ListEventSource Source #
Instances
Constructors
Cell | |
Fields
|
data ScrollStateChange Source #
Constructors
Stationary | |
Dragging | |
InertialScrolling | |
SmoothAnimationScrolling |
Instances
Decoder
Event Map
listEvents :: Events Source #