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

Miso.Lynx.Element.View.Method

Description

 
Synopsis

Methods

boundingClientRect :: MisoString -> BoundingClientRect -> (Rect -> action) -> (MisoString -> action) -> Effect parent 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 model Action
update GetRect =
  boundingClientRect defaultBoundingClientRect "#box" Success Failure
update (Succes Rect {..}) =
  consoleLog "Successfuly got Rect"
update (Failure errorMsg) =
  consoleLog ("Failed to call getClientBoundingRect: " <> errorMsg)

takeScreenshot :: MisoString -> TakeScreenshot -> (JSVal -> action) -> (MisoString -> action) -> Effect parent 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 model Action
update GetScreenshot = takeScreenshot
  defaultTakeScreenshot "#my-view" Success Failure
update (Succes image) =
  consoleLog "Successfuly got image"
  consoleLog' image
update (Failure errorMsg) =
  consoleLog ("Failed to call takeScreenshot: " <> errorMsg)

requestAccessibilityFocus :: MisoString -> (JSVal -> action) -> (MisoString -> action) -> Effect parent 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 model Action
update GetFocus = requestAccessibilityFocus "#my-view" Success Failure
update Success = consoleLog "Successfuly got focus"
update (Failure errorMsg) =
  consoleLog ("Failed to call requestAccessibilityFocus: " <> errorMsg)

Types

data Rect Source #

Result of calling getClientBoundingRect

Constructors

Rect 

Fields

Instances

Instances details
Show Rect Source # 
Instance details

Defined in Miso.Lynx.Element.View.Method

Methods

showsPrec :: Int -> Rect -> ShowS #

show :: Rect -> String #

showList :: [Rect] -> ShowS #

Eq Rect Source # 
Instance details

Defined in Miso.Lynx.Element.View.Method

Methods

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

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

FromJSVal Rect Source # 
Instance details

Defined in Miso.Lynx.Element.View.Method

data BoundingClientRect Source #

Constructors

BoundingClientRect 

Fields

data TakeScreenshot Source #

Constructors

TakeScreenshot 

Fields

  • format :: MisoString

    e.g. Specify the image format, supports jpeg and png, the default is jpeg

  • scale :: Double

    e.g. Specify the image quality, 0 < scale <= 1, the default is 1, the smaller the value, the blurrier and smaller the size.

Instances

Instances details
ToJSVal TakeScreenshot Source # 
Instance details

Defined in Miso.Lynx.Element.View.Method

Smart constructors