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.Method

Description

Since: 1.13.0.0

Synopsis

Methods

scrollToPosition :: MisoString -> ScrollToPosition -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action Source #

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

The front end can execute boundingClientRect through the SelectorQuery API.

data Action
  = Success MisoString
  | Failure MisoString
  | GetRect

update :: Action -> Effect props model Action
update GetRect =
  scrollToPosition defaultscrollToPosition "#box" Success Failure
update (Succes _) =
  consoleLog "Successfuly got position"
update (Failure errorMsg) =
  consoleLog ("Failed to call scrollToPosition: " <> errorMsg)

autoScroll :: MisoString -> AutoScroll -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action Source #

Invokes the Lynx autoScroll method on a list element.

Takes a selector, a AutoScroll of parameters, a success continuation and an error continuation.

Since: 1.13.0.0

getVisibleCells :: MisoString -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action Source #

Invokes the Lynx getVisibleCells method on a list element, reporting the cells currently on screen.

Since: 1.13.0.0

scrollBy :: MisoString -> ScrollBy -> (Consumed -> action) -> (MisoString -> action) -> Effect context props model action Source #

Invokes the Lynx scrollBy method on a list element.

Takes a selector, a ScrollBy of parameters, a success continuation and an error continuation.

Since: 1.13.0.0

Types

data ScrollToPosition Source #

Parameters for scrollToPosition: which cell to scroll to, how far past it to continue, how to align it, and whether to animate.

Since: 1.13.0.0

Constructors

ScrollToPosition 

Fields

  • stpPosition :: Double

    Specifies the index of the node to scroll to, with a range of [0, data source count)

  • stpOffset :: Double

    After applying alignTo alignment, continue scrolling the offset length

  • stpAlignTo :: MisoString

    The position of the target node in the view after scrolling.

  • stpSmooth :: Bool

    Whether there is animation during the scrolling process

data AutoScroll Source #

Parameters for autoScroll: the scroll rate, whether to start or stop, and whether to stop automatically at the end of the list.

Since: 1.13.0.0

Constructors

AutoScroll 

Fields

Instances

Instances details
ToJSVal AutoScroll Source # 
Instance details

Defined in Miso.Native.Element.List.Method

data ScrollBy Source #

Parameters for scrollBy: the distance to scroll from the current position.

Since: 1.13.0.0

Constructors

ScrollBy 

Instances

Instances details
ToJSVal ScrollBy Source # 
Instance details

Defined in Miso.Native.Element.List.Method

data Consumed Source #

How much of a requested scrollBy the list actually consumed.

A list already at its end consumes less than was asked for; the remainder is what an enclosing scroller may take.

Since: 1.13.0.0

Instances

Instances details
Show Consumed Source # 
Instance details

Defined in Miso.Native.Element.List.Method

Eq Consumed Source # 
Instance details

Defined in Miso.Native.Element.List.Method

FromJSVal Consumed Source # 
Instance details

Defined in Miso.Native.Element.List.Method

Smart constructors

defaultAutoScroll :: AutoScroll Source #

A AutoScroll with sensible defaults (stopped).

Override only the fields you need.

Since: 1.13.0.0

defaultScrollBy :: ScrollBy Source #

A ScrollBy with sensible defaults (zero offset).

Override only the fields you need.

Since: 1.13.0.0