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

Description

Since: 1.13.0.0

Synopsis

Methods

scrollTo :: MisoString -> ScrollTo -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action Source #

Invokes the Lynx scrollTo method on a scroll-view element.

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

Since: 1.13.0.0

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

Invokes the Lynx autoScroll method on a scroll-view element.

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

Since: 1.13.0.0

scrollIntoView :: MisoString -> ScrollIntoView -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action Source #

Invokes the Lynx scrollIntoView method on a scroll-view element.

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

Since: 1.13.0.0

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

Invokes the Lynx scrollBy method on a scroll-view element.

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

Since: 1.13.0.0

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

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

Retrieves the current scroll information of the <scroll-view>.

data Action = GetInfo | InfoReceived ScrollInfo | GotError MisoString

update :: Action -> Effect props model Action
update = \case
  GetInfo -> getScrollInfo "#box" InfoReceived GotError
  InfoReceived ScrollInfo {..} -> io_ (consoleLog "got scroll info")
  GotError errMsg -> io_ (consoleLog errMsg)

Types

data ScrollTo Source #

Parameters for scrollTo: the target index, an extra offset to continue past it, and whether the movement is animated.

Since: 1.13.0.0

Constructors

ScrollTo 

Fields

Instances

Instances details
Show ScrollTo Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

Eq ScrollTo Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

ToJSVal ScrollTo Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

data AutoScroll Source #

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

Since: 1.13.0.0

Constructors

AutoScroll 

Fields

data ScrollIntoView Source #

Parameters for scrollIntoView: where the element should come to rest within the viewport.

Since: 1.13.0.0

Constructors

ScrollIntoView 

Fields

  • block :: MisoString

    Vertical alignment options: "start" aligns top | "center" centers | "end" aligns bottom

  • inline :: MisoString

    Horizontal alignment options: "start" aligns left | "center" centers | "end" aligns right

  • behavior :: MisoString

    "smooth" | "none" whether to animate scrolling

newtype ScrollBy Source #

Parameters for scrollBy: the distance to scroll, relative to the current position.

Since: 1.13.0.0

Constructors

ScrollBy 

Instances

Instances details
Show ScrollBy Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

Eq ScrollBy Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

ToJSVal ScrollBy Source # 
Instance details

Defined in Miso.Native.Element.ScrollView.Method

data ScrollInfo Source #

Result of calling getScrollInfo

Constructors

ScrollInfo 

Fields

Smart constructors

defaultScrollTo :: ScrollTo Source #

A ScrollTo with sensible defaults (first index, no offset, animated).

Override only the fields you need.

Since: 1.13.0.0

defaultAutoScroll :: AutoScroll Source #

A AutoScroll with sensible defaults (stopped).

Override only the fields you need.

Since: 1.13.0.0

defaultScrollIntoView :: ScrollIntoView Source #

A ScrollIntoView with sensible defaults (nearest alignment).

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