OptionalelementWhen set, binds the keyboard data to the element with this ID on the current layer.
OptionalfocusFocus target in which the binding must be active to take effect. A plain string binds the key to the default focus layer; an explicit group binds it to that group.
OptionalmodeRestrict this binding to a specific mode set via KeyboardEngine.setMode.
When the active mode (read from the pipeline context) does not match
this value, the binding is skipped as if it does not exist — the event
continues to the next binding or layer. When omitted, the binding fires
in all modes (including no-mode, i.e. currentMode === null).
Modes must be registered before use — via EngineProps.modes or KeyboardEngine.addMode.
OptionalobserverCallback invoked on every key press while counting toward times.
Receives the number of remaining presses before the handler fires.
Requires times to be set; throws at registration otherwise.
How many more presses are needed before the handler fires.
OptionalonceWhen true, the binding is automatically removed after its first
invocation. The unbind happens before the handler executes, so
even if the handler throws, the binding is consumed.
Useful for one-shot key bindings (e.g. "press any key to continue").
OptionalstopsWhen true, the binding stops responding once any layer is present
on screen; it only takes effect while no layers are open.
Enabling this on a binding registered inside a layer has no effect —
it only works when enabled on the page. Note that when a page exists
without any layers and no elementId is passed, the option takes
effect and the binding data is placed on the current page.
OptionaltimesNumber of times the bound key(s) must be pressed before the handler
fires. Defaults to undefined (fire immediately on every press).
The counter is per-binding (all keys in the keys array share the
same counter) and never auto-resets. When the counter reaches
times, the handler fires and the counter resets to 0.
When combined with once: true, the binding is removed after the
handler fires (i.e. after times presses).
Must be >= 1. Throws if 0 or negative.
Examples:
times: 2 → handler fires on the 2nd, 4th, 6th… press.times: 3, once: true → handler fires on the 3rd press and unbinds.OptionalwhenOptional condition callback. When provided, the binding only fires if
this callback returns true at the moment of the key press.
When false, the binding is skipped — the event continues to the next
binding or layer. This is an AND relationship with elementId / focusId.
Examples:
when: () => isEditing — binding only active during editingwhen: () => isEditing && !isReadOnly
Options for KeyboardEngine.boundKeyboard.