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.X.Element.Webview.Event

Description

 
Synopsis

Events

onErrorWith :: (WebviewErrorEvent -> DOMRef -> action) -> Attribute model action Source #

Like onError, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onErrorMain :: (WebviewErrorEvent -> action) -> EventHandler model action Source #

Like onError, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = Errored WebviewErrorEvent

view_ [ event (static (onErrorMain Errored)) ] [ "some view" ]

onErrorMainWith :: (WebviewErrorEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onErrorMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = Errored WebviewErrorEvent Model DOMRef

view_ [ event (static (onErrorMainWith Errored)) ] [ "some view" ]

onLoad :: action -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/webview.html#bindload

Triggered when the webview loads successfully.

onLoadWith :: (DOMRef -> action) -> Attribute model action Source #

Like onLoad, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onLoadMain :: action -> EventHandler model action Source #

Like onLoad, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = Loaded

view_ [ event (static (onLoadMain Loaded)) ] [ "some view" ]

onLoadMainWith :: (model -> DOMRef -> action) -> EventHandler model action Source #

Like onLoadMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = Loaded Model DOMRef

view_ [ event (static (onLoadMainWith Loaded)) ] [ "some view" ]

onLocationChange :: (MisoString -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/webview.html#bindlocationchange

  • Desktop, Lynx 3.5+*. Triggered when the location changes.

onLocationChangeWith :: (MisoString -> DOMRef -> action) -> Attribute model action Source #

Like onLocationChange, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onLocationChangeMain :: (MisoString -> action) -> EventHandler model action Source #

Like onLocationChange, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = LocationChanged MisoString

view_ [ event (static (onLocationChangeMain LocationChanged)) ] [ "some view" ]

onLocationChangeMainWith :: (MisoString -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onLocationChangeMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = LocationChanged MisoString Model DOMRef

view_ [ event (static (onLocationChangeMainWith LocationChanged)) ] [ "some view" ]

onMessage :: (MisoString -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/webview.html#bindmessage

Triggered when a message is posted from JavaScript.

onMessageWith :: (MisoString -> DOMRef -> action) -> Attribute model action Source #

Like onMessage, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onMessageMain :: (MisoString -> action) -> EventHandler model action Source #

Like onMessage, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = Message MisoString

view_ [ event (static (onMessageMain Message)) ] [ "some view" ]

onMessageMainWith :: (MisoString -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onMessageMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = Message MisoString Model DOMRef

view_ [ event (static (onMessageMainWith Message)) ] [ "some view" ]

onOpenWindow :: (MisoString -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/webview.html#bindopenwindow

  • Desktop, Lynx 3.5+*. Triggered on an open-window event.

onOpenWindowWith :: (MisoString -> DOMRef -> action) -> Attribute model action Source #

Like onOpenWindow, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onOpenWindowMain :: (MisoString -> action) -> EventHandler model action Source #

Like onOpenWindow, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = OpenWindow MisoString

view_ [ event (static (onOpenWindowMain OpenWindow)) ] [ "some view" ]

onOpenWindowMainWith :: (MisoString -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onOpenWindowMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = OpenWindow MisoString Model DOMRef

view_ [ event (static (onOpenWindowMainWith OpenWindow)) ] [ "some view" ]

Types

data WebviewErrorEvent Source #

Payload of the binderror event.

Constructors

WebviewErrorEvent 

Fields

Decoders

urlDecoder :: Decoder MisoString Source #

Decodes the url field of bindlocationchange and bindopenwindow.

messageDecoder :: Decoder MisoString Source #

Decodes the msg field of bindmessage.

Event Map