| Copyright | (C) 2016-2026 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.Native.Element.List.Method
Contents
Description
Since: 1.13.0.0
Synopsis
- scrollToPosition :: MisoString -> ScrollToPosition -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action
- autoScroll :: MisoString -> AutoScroll -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action
- getVisibleCells :: MisoString -> (MisoString -> action) -> (MisoString -> action) -> Effect context props model action
- scrollBy :: MisoString -> ScrollBy -> (Consumed -> action) -> (MisoString -> action) -> Effect context props model action
- data ScrollToPosition = ScrollToPosition {}
- data AutoScroll = AutoScroll {}
- data ScrollBy = ScrollBy {}
- data Consumed = Consumed {
- consumedX :: Double
- consumedY :: Double
- unconsumedX :: Double
- unconsumedY :: Double
- defaultScrollToPosition :: ScrollToPosition
- defaultAutoScroll :: AutoScroll
- defaultScrollBy :: ScrollBy
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 #
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
| |
Instances
| Show ScrollToPosition Source # | |
Defined in Miso.Native.Element.List.Method Methods showsPrec :: Int -> ScrollToPosition -> ShowS # show :: ScrollToPosition -> String # showList :: [ScrollToPosition] -> ShowS # | |
| Eq ScrollToPosition Source # | |
Defined in Miso.Native.Element.List.Method Methods (==) :: ScrollToPosition -> ScrollToPosition -> Bool # (/=) :: ScrollToPosition -> ScrollToPosition -> Bool # | |
| ToJSVal ScrollToPosition Source # | |
Defined in Miso.Native.Element.List.Method | |
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 | |
Instances
| ToJSVal AutoScroll Source # | |
Defined in Miso.Native.Element.List.Method | |
Parameters for scrollBy: the distance to scroll from the current
position.
Since: 1.13.0.0
Constructors
| ScrollBy | |
Fields | |
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
Constructors
| Consumed | |
Fields
| |
Smart constructors
defaultScrollToPosition :: ScrollToPosition Source #
Smart constructor for constructing scrollToPosition