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.Input.Event

Description

 
Synopsis

Events

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

https://lynxjs.org/api/elements/built-in/input.html#bindblur

Triggered when the input is blurred, outputting the current value.

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

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

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

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

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

data Action = Blurred MisoString

view_ [ event (static (onBlurMain Blurred)) ] [ "some view" ]

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

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

data Action = Blurred MisoString Model DOMRef

view_ [ event (static (onBlurMainWith Blurred)) ] [ "some view" ]

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

https://lynxjs.org/api/elements/built-in/input.html#bindconfirm

Triggered when the confirm button is clicked, outputting the current value.

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

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

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

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

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

data Action = Confirmed MisoString

view_ [ event (static (onConfirmMain Confirmed)) ] [ "some view" ]

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

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

data Action = Confirmed MisoString Model DOMRef

view_ [ event (static (onConfirmMainWith Confirmed)) ] [ "some view" ]

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

https://lynxjs.org/api/elements/built-in/input.html#bindfocus

Triggered when the input is focused, outputting the current value.

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

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

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

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

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

data Action = Focused MisoString

view_ [ event (static (onFocusMain Focused)) ] [ "some view" ]

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

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

data Action = Focused MisoString Model DOMRef

view_ [ event (static (onFocusMainWith Focused)) ] [ "some view" ]

onInput :: (InputEvent -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/input.html#bindinput

Triggered when the input content changes.

onInputWith :: (InputEvent -> DOMRef -> action) -> Attribute model action Source #

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

onInputMain :: (InputEvent -> action) -> EventHandler model action Source #

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

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

data Action = Changed InputEvent

view_ [ event (static (onInputMain Changed)) ] [ "some view" ]

onInputMainWith :: (InputEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

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

data Action = Changed InputEvent Model DOMRef

view_ [ event (static (onInputMainWith Changed)) ] [ "some view" ]

onSelection :: (SelectionEvent -> action) -> Attribute model action Source #

onSelectionWith :: (SelectionEvent -> DOMRef -> action) -> Attribute model action Source #

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

onSelectionMain :: (SelectionEvent -> action) -> EventHandler model action Source #

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

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

data Action = Selected SelectionEvent

view_ [ event (static (onSelectionMain Selected)) ] [ "some view" ]

onSelectionMainWith :: (SelectionEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

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

data Action = Selected SelectionEvent Model DOMRef

view_ [ event (static (onSelectionMainWith Selected)) ] [ "some view" ]

Types

data InputEvent Source #

Payload of the bindinput event.

Constructors

InputEvent 

Fields

Instances

Instances details
Show InputEvent Source # 
Instance details

Defined in Miso.Native.X.Element.Input.Event

Eq InputEvent Source # 
Instance details

Defined in Miso.Native.X.Element.Input.Event

data SelectionEvent Source #

Payload of the bindselection event.

Constructors

SelectionEvent 

Fields

Decoders

inputValueDecoder :: Decoder MisoString Source #

Decodes the value field shared by bindblur, bindconfirm and bindfocus.

Event Map