| 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.View.Method
Contents
Description
Synopsis
- boundingClientRect :: MisoString -> BoundingClientRect -> (Rect -> action) -> (MisoString -> action) -> Effect context props model action
- takeScreenshot :: MisoString -> TakeScreenshot -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action
- requestAccessibilityFocus :: MisoString -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action
- data Rect = Rect {}
- data BoundingClientRect = BoundingClientRect {}
- data TakeScreenshot = TakeScreenshot {
- format :: MisoString
- scale :: Double
- defaultBoundingClientRect :: BoundingClientRect
- defaultTakeScreenshot :: TakeScreenshot
Methods
boundingClientRect :: MisoString -> BoundingClientRect -> (Rect -> action) -> (MisoString -> action) -> Effect context props model action Source #
https://lynxjs.org/api/elements/built-in/view.html#boundingclientrect
The front end can execute boundingClientRect through the SelectorQuery API.
data Action
= Success Rect
| Failure MisoString
| GetRect
update :: Action -> Effect props model Action
update = \case
GetRect ->
boundingClientRect defaultBoundingClientRect "#box" Success Failure
Succes Rect {..} ->
consoleLog "Successfuly got Rect"
Failure errorMsg ->
consoleLog ("Failed to call getClientBoundingRect: " <> errorMsg)
takeScreenshot :: MisoString -> TakeScreenshot -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action Source #
https://lynxjs.org/api/elements/built-in/view.html#takescreenshot
The front end can execute takeScreenshot through the SelectorQuery API.
data Action
= Success Image
| Failure MisoString
| GetScreenshot
update :: Action -> Effect props model Action
update = \case
GetScreenshot ->
takeScreenshot defaultTakeScreenshot "#my-view" Success Failure
Succes image -> do
consoleLog "Successfuly got image"
consoleLog' image
Failure errorMsg ->
consoleLog ("Failed to call takeScreenshot: " <> errorMsg)
requestAccessibilityFocus :: MisoString -> (JSVal -> action) -> (MisoString -> action) -> Effect context props model action Source #
https://lynxjs.org/api/elements/built-in/view.html#requestaccessibilityfocus
The front end can execute requestAccessiblityFocus through the SelectorQuery API.
data Action
= Success
| Failure MisoString
| GetFocus
update :: Action -> Effect props model Action
update = \case
GetFocus -> requestAccessibilityFocus "#my-view" Success Failure
Success -> consoleLog "Successfuly got focus"
Failure errorMsg ->
consoleLog ("Failed to call requestAccessibilityFocus: " <> errorMsg)
Types
Result of calling getClientBoundingRect
Constructors
| Rect | |
data BoundingClientRect Source #
Constructors
| BoundingClientRect | |
Fields
| |
Instances
data TakeScreenshot Source #
Constructors
| TakeScreenshot | |
Fields
| |
Instances
| ToJSVal TakeScreenshot Source # | |
Defined in Miso.Native.Element.View.Method | |
Smart constructors
defaultBoundingClientRect :: BoundingClientRect Source #
Smart constructor for constructing boundingClientRect
defaultTakeScreenshot :: TakeScreenshot Source #
Smart constructor for calling TakeScreenshot