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

Miso.Native.Element.List.Event

Description

 
Synopsis

Event

onScroll :: (ScrollEvent -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/list.html#scroll

<list> scroll event.

data Action = HandleScroll ScrollEvent

view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScroll HandleScroll ] [ ]

update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
  io_ (consoleLog "handled scroll event")

onScrollWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #

Like onScroll, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onScrollMain :: (ScrollEvent -> action) -> EventHandler model action Source #

Like onScroll, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleScroll ScrollEvent

view_ [ event (static (onScrollMain HandleScroll)) ] [ "some view" ]

onScrollMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onScrollMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleScroll ScrollEvent Model DOMRef

view_ [ event (static (onScrollMainWith HandleScroll)) ] [ "some view" ]

onScrollToUpper :: (ScrollEvent -> action) -> Attribute model 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 :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScrollToUpper HandleScroll ] [ ]

update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
  io_ (consoleLog "handled scroll event")

onScrollToUpperWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #

Like onScrollToUpper, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onScrollToUpperMain :: (ScrollEvent -> action) -> EventHandler model action Source #

Like onScrollToUpper, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleScroll ScrollEvent

view_ [ event (static (onScrollToUpperMain HandleScroll)) ] [ "some view" ]

onScrollToUpperMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onScrollToUpperMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleScroll ScrollEvent Model DOMRef

view_ [ event (static (onScrollToUpperMainWith HandleScroll)) ] [ "some view" ]

onScrollToLower :: (ScrollEvent -> action) -> Attribute model 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 :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScrollToLower HandleScroll ] [ ]

update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
  io_ (consoleLog "handled scroll event")

onScrollToLowerWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #

Like onScrollToLower, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onScrollToLowerMain :: (ScrollEvent -> action) -> EventHandler model action Source #

Like onScrollToLower, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleScroll ScrollEvent

view_ [ event (static (onScrollToLowerMain HandleScroll)) ] [ "some view" ]

onScrollToLowerMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onScrollToLowerMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleScroll ScrollEvent Model DOMRef

view_ [ event (static (onScrollToLowerMainWith HandleScroll)) ] [ "some view" ]

onScrollStateChange :: (ScrollStateChange -> action) -> Attribute model 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 :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScrollStateChange HandleScrollState ] [ ]

update :: Action -> Effect props Model Action
update (HandleScroll Stationary) =
  io_ (consoleLog "Received Stationary scroll state change")
update _ = pure ()

onScrollStateChangeWith :: (ScrollStateChange -> DOMRef -> action) -> Attribute model action Source #

Like onScrollStateChange, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onScrollStateChangeMain :: (ScrollStateChange -> action) -> EventHandler model action Source #

Like onScrollStateChange, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleScrollState ScrollStateChange

view_ [ event (static (onScrollStateChangeMain HandleScrollState)) ] [ "some view" ]

onScrollStateChangeMainWith :: (ScrollStateChange -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onScrollStateChangeMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleScrollState ScrollStateChange Model DOMRef

view_ [ event (static (onScrollStateChangeMainWith HandleScrollState)) ] [ "some view" ]

onLayoutComplete :: (LayoutCompleteEvent -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/list.html#layoutcomplete

Callback triggered after <list> layout is complete.

data Action = HandleLayout LayoutCompleteEvent

view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onLayoutComplete HandleLayout ] [ ]

update :: Action -> Effect props Model Action
update (HandleLayout LayoutCompleteEvent {..}) =
  io_ (consoleLog "Received LayoutCompleteEvent")

onLayoutCompleteWith :: (LayoutCompleteEvent -> DOMRef -> action) -> Attribute model action Source #

Like onLayoutComplete, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onLayoutCompleteMain :: (LayoutCompleteEvent -> action) -> EventHandler model action Source #

Like onLayoutComplete, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleLayout LayoutCompleteEvent

view_ [ event (static (onLayoutCompleteMain HandleLayout)) ] [ "some view" ]

onLayoutCompleteMainWith :: (LayoutCompleteEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onLayoutCompleteMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleLayout LayoutCompleteEvent Model DOMRef

view_ [ event (static (onLayoutCompleteMainWith HandleLayout)) ] [ "some view" ]

onSnap :: (SnapEvent -> action) -> Attribute model 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 :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onSnap HandleSnap ] [ ]

update :: Action -> Effect props Model Action
update (HandleSnap SnapEvent {..}) =
  io_ (consoleLog "Received SnapEvent")

onSnapWith :: (SnapEvent -> DOMRef -> action) -> Attribute model action Source #

Like onSnap, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onSnapMain :: (SnapEvent -> action) -> EventHandler model action Source #

Like onSnap, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleSnap SnapEvent

view_ [ event (static (onSnapMain HandleSnap)) ] [ "some view" ]

onSnapMainWith :: (SnapEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onSnapMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleSnap SnapEvent Model DOMRef

view_ [ event (static (onSnapMainWith HandleSnap)) ] [ "some view" ]

Types

data ScrollEvent Source #

Constructors

ScrollEvent 

Fields

data SnapEvent Source #

Constructors

SnapEvent 

Fields

Instances

Instances details
Show SnapEvent Source # 
Instance details

Defined in Miso.Native.Element.List.Event

Eq SnapEvent Source # 
Instance details

Defined in Miso.Native.Element.List.Event

data LayoutCompleteEvent Source #

Constructors

LayoutCompleteEvent 

Fields

data DiffResult Source #

Constructors

DiffResult 

Instances

Instances details
Show DiffResult Source # 
Instance details

Defined in Miso.Native.Element.List.Event

Eq DiffResult Source # 
Instance details

Defined in Miso.Native.Element.List.Event

FromJSON DiffResult Source # 
Instance details

Defined in Miso.Native.Element.List.Event

data Cell Source #

Constructors

Cell 

Fields

Instances

Instances details
Show Cell Source # 
Instance details

Defined in Miso.Native.Element.List.Event

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Eq Cell Source # 
Instance details

Defined in Miso.Native.Element.List.Event

Methods

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

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

FromJSON Cell Source # 
Instance details

Defined in Miso.Native.Element.List.Event

data ScrollStateChange Source #

Decoder

Event Map