Elmish.HTML.Events
- Package
- purescript-elmish-html
- Repository
- collegevine/purescript-elmish-html
This module defines types that are used as event objects in React built-in events, as well as some convenience functions on them.
#InputChangeEvent Source
newtype InputChangeEventEvent object specifically for the onChange event of the <input> tag.
While it doesn't have any special properties relative to SyntheticEvent,
it's modeled as a separate type so as to support the custom accessors
inputText and inputChecked, thus reducing the friction in the most
frequent use case of:
input { type: "text", onChange: dispatch <| MyInputChanged <<< E.inputText }
input { type: "checkbox", onChange: dispatch <| MyCheckboxChanged <<< E.inputChecked }
Constructors
Instances
#KeyboardEvent Source
newtype KeyboardEventEvent object for keyboard-related events such as onKeyDown or onKeyPress. This
type follows React docs at https://reactjs.org/docs/events.html#keyboard-events
Constructors
Instances
#MouseEvent Source
newtype MouseEventEvent object for mouse-related events such as onMouseDown or onMouseMove. This
type follows React docs at https://reactjs.org/docs/events.html#mouse-events
Constructors
Instances
#SelectChangeEvent Source
newtype SelectChangeEventEvent object specifically for the onChange event of the <select> tag.
While it doesn't have any special properties relative to SyntheticEvent,
it's modeled as a separate type so as to support the custom accessor
selectSelectedValue, thus reducing the friction in the most frequent use
case of:
select { onChange: dispatch <| MyInputChanged <<< E.selectSelectedValue }
Constructors
Instances
#SyntheticEvent Source
newtype SyntheticEventThe most generic event object from React, for events that don't have any special properties. This type follows React docs at https://reactjs.org/docs/events.html
Constructors
Instances
#TextAreaChangeEvent Source
newtype TextAreaChangeEventEvent object specifically for the onChange event of the <textarea> tag.
While it doesn't have any special properties relative to SyntheticEvent,
it's modeled as a separate type so as to support the custom accessor
textareaText, thus reducing the friction in the most frequent use case of:
textarea { onChange: dispatch <| MyTextareaChanged <<< E.textareaText }
Constructors
Instances
#TouchEvent Source
newtype TouchEventEvent object for touch-related events such as onTouchStart or
onTouchMove. This type follows React docs at https://reactjs.org/docs/events.html#touch-events
Constructors
Instances
#inputChecked Source
inputChecked :: InputChangeEvent -> BooleanConvenience accessor for extracting the checked state of an
<input type=checkbox> tag in its onChange handler.
input { type: "checkbox", onChange: dispatch <| MyCheckboxChanged <<< E.inputChecked }
#inputText Source
inputText :: InputChangeEvent -> StringConvenience accessor for extracting the value of an <input type=text> tag
in its onChange handler.
input { type: "text", onChange: dispatch <| MyInputChanged <<< E.inputText }
#selectSelectedValue Source
selectSelectedValue :: SelectChangeEvent -> StringConvenience accessor for extracting the selected value of a <select> tag
in its onChange handler.
select { onChange: dispatch <| MyInputChanged <<< E.selectSelectedValue }
#textareaText Source
textareaText :: TextAreaChangeEvent -> StringConvenience accessor for extracting the value of a <textarea> tag
in its onChange handler.
textarea { onChange: dispatch <| MyTextareaChanged <<< E.textareaText }
Re-exports from Elmish.Dispatch
#EventHandler Source
newtype EventHandler eventType of event handling functions. This is the standard shape of all event
handlers on React's built-in components (aka tags) and most third-party
components as well. The constructor is intentionally hidden. Use the
handle function to create instances of this type.
Instances
CanPassToJavaScript (EventHandler event)
#handle Source
handle :: forall event. Dispatch event -> EventHandler eventCreate a React event handler from a function event -> Effect Unit.
Re-exports from Elmish.HTML.Events.Methods
#stopPropagation Source
stopPropagation :: forall e. IsSyntheticEvent e => e -> Effect UnitPrevents propagation of the event up the React DOM tree. See also https://reactjs.org/docs/events.html
#preventDefault Source
preventDefault :: forall e. IsSyntheticEvent e => e -> Effect UnitPrevents the default handling of the event by the browser. See also https://reactjs.org/docs/events.html
#getModifierState Source
getModifierState :: forall e. IsKeyboardOrMouseEvent e => String -> e -> BooleanReturns the state of a given modifier key during an event, as defined in https://reactjs.org/docs/events.html#keyboard-events
This function applies only to certain kinds of events, such as MouseEvent
or KeyboardEvent.