Page
Library
Module
Module type
Parameter
Class
Class type
Source
Vdom
SourceA "Virtual application" (or "Elm-like" application) is described by two types:
and by the following values:
Commands represents (typically) asynchronous operations, such as querying a server, or waiting for some timer.
Messages can be generated either by a VDOM tree (to encapsulate DOM events) or by commands (to notify their outcome).
type 'msg event_handler =
| MouseDown of mouse_event -> 'msg
| Click of mouse_event -> 'msg
| DblClick of mouse_event -> 'msg
| Focus of 'msg
| Blur of 'msg
| Input of string -> 'msg
| Change of string -> 'msg
| ChangeIndex of int -> 'msg
| ChangeChecked of bool -> 'msg
| MouseMove of mouse_event -> 'msg
| KeyDown of key_event -> 'msg
| KeyDownCancel of key_event -> 'msg option
| ContextMenu of mouse_event -> 'msg
| CustomEvent of Custom.event -> 'msg option
type 'msg attribute =
| Property of string * prop_val
| Style of string * string
| Handler of 'msg event_handler
| Attribute of string * string
Pass the checked
property of the event targer.
Pass the selected_index
property of the event target.
Generic DOM properties correspond to actual properties on DOM objects. The name of these properties is usually the same as the corresponding HTML attribute, but not always (e.g. "class" attribute, but "className" property).
Pseudo-attributes are interpreted in a special way by the infrastructure.
When this pseudo-attribute is first applied to an element, its parent is automatically scrolled (vertically) to show the element.
When this pseudo-attribute is first applied to an element, the element gets focused.
When this pseudo-attribute is first applied to an element, the element is moved to a fixed position below its parents.
When this pseudo-attribute is first applied to an element, or applied with a different counter as the previous time, the element gets focused.
A generic element.
A generic element in the SVG namespace.
Map attributes of a vdom element
Wrap all messages generated by a VDOM tree with the provided function.
Apply the function to generate a VDOM tree only if the function or its argument have changed (physically) from the previous synchronization.
Note that physical equality is used both for the function and its argument. In particular, this is unlikely to behave as expected if the function is defined inline (as an abstraction) or obtained by a (partial) function application. Instead, the functional argument should be a simple reference to a globally defined function.
TODO: n-ary versions
.
A custom kind of node. Usually not used directly.