package virtual_dom
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=812711b4d5ce634a413580cd7096482de8d71abec9ae37bb01f7c0dcec2968ec
doc/virtual_dom.keyboard/Vdom_keyboard/Variable_keyboard_event_handler/index.html
Module Vdom_keyboard.Variable_keyboard_event_handler
Source
A Variable_keyboard_event_handler.t
provides a way of representing a keyboard event handler that contains both a (possibly empty) constant set of actions and a variable set of actions that depends on some 'env
variable. In order to handle keyboard events or produce help text, it must first be converted to a Keyboard_event_handler.t
using the function to_const_handler
.
val of_const_handler :
?variable_actions:('env -> Action.t list) ->
Keyboard_event_handler.t ->
'env t
add_variable_actions
, add_variable_commands
, and add_variable_disabled_keys
add a new variable set of actions to a variable keyboard event handler. This does not replace any existing variable actions in the handler, but instead adds to them.
The add_*_exn
and set_*
functions below behave in the same was as the corresponding functions in Keyboard_event_handler
.
to_const_handler
evaluates the variable set of actions for the given 'env
value, and combines them with the constant set of actions to create a keyboard event handler.
It is possible that for a given 'env
value, multiple actions are defined for the same key. In that case, the latest variable action is used when creating the constant keyboard event handler.
Variable_handler_command
and Variable_handler_action
provide a way of representing commands whose keys, description and group are constant, but whose handler varies with the 'env
variable.
add_variable_handler_action
and add_variable_handler_command
are utility functions for adding variable handler actions to an existing variable keyboard event handler. Under the hood, the variable handler action is converted to a variable action of the form 'env -> Action.t
.