incr_dom_keyboard

A library for Incr_dom keybinding and keyboard shortcut helpers
IN THIS PACKAGE
type 'env t
val sexp_of_t : ( 'env -> Ppx_sexp_conv_lib.Sexp.t ) -> 'env t -> Ppx_sexp_conv_lib.Sexp.t
val empty : 'env t
val of_const_handler : ?variable_actions:( 'env -> Action.t list ) -> Keyboard_event_handler.t -> 'env t
val add_variable_actions : 'env t -> ( 'env -> Action.t list ) -> '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.

val add_variable_commands : 'env t -> ( 'env -> Command.t list ) -> 'env t
val add_variable_disabled_keys : 'env t -> ( 'env -> Keystroke.t list ) -> 'env t
val add_action_exn : 'env t -> Action.t -> 'env t

The add_*_exn and set_* functions below behave in the same was as the corresponding functions in Keyboard_event_handler.

val add_command_exn : 'env t -> Command.t -> 'env t
val add_disabled_key_exn : 'env t -> Keystroke.t -> 'env t
val set_action : 'env t -> Action.t -> 'env t
val set_command : 'env t -> Command.t -> 'env t
val set_disabled_key : 'env t -> Keystroke.t -> 'env t
val to_const_handler : 'env t -> 'env -> Keyboard_event_handler.t

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.

module Variable_handler_command : sig ... end

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.

module Variable_handler_action : sig ... end
val add_variable_handler_action : 'env t -> 'env Variable_handler_action.t -> 'env t

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.

val add_variable_handler_command : 'env t -> 'env Variable_handler_command.t -> 'env t