miso-lynx
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Lynx.Element.List.Event

Description

 
Synopsis

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

data SnapEvent Source #

Constructors

SnapEvent 

Fields

Instances

Instances details
Show SnapEvent Source # 
Instance details

Defined in Miso.Lynx.Element.List.Event

Eq SnapEvent Source # 
Instance details

Defined in Miso.Lynx.Element.List.Event

data LayoutCompleteEvent Source #

Constructors

LayoutCompleteEvent 

Fields

data Cell Source #

Constructors

Cell 

Fields

Instances

Instances details
FromJSON Cell Source # 
Instance details

Defined in Miso.Lynx.Element.List.Event

Show Cell Source # 
Instance details

Defined in Miso.Lynx.Element.List.Event

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Eq Cell Source # 
Instance details

Defined in Miso.Lynx.Element.List.Event

Methods

(==) :: Cell -> Cell -> Bool #

(/=) :: Cell -> Cell -> Bool #

Decoder

Event Map