Output Functions - the Keyboard API
The KeymanWeb core object window.keyman.interface
(with legacy-oriented, deprecated alias
KeymanWeb
) exposes a number of functions for low-level processing of input, context and output. These functions are
designed for use by keyboards compiled through Keyman Developer in order to facilitate input text processing and will
also work for custom-coded KeymanWeb keyboards. As such, most of these functions should only be called by keyboard code,
and a good understanding of the Keyman Keyboard Language will prove extremely beneficial
toward understanding the keyboard API functions enumerated in this section.
Custom user interfaces would not normally use these functions, but they are described here as some custom keyboards, such as IME-style keyboards, may need to interact with the user interface.
any
Function (Deprecated)- Returns whether or not the char
ch
is found within theany
(store
) string, setting an internally-tracked index for use in theindexOutput
function. - Shorthand name:
KeymanWeb.KA
beep
Function- Flash body or element as substitute for an audible feedback
beep
. - Shorthand name:
KeymanWeb.KB
beepReset
Function- Cancels a previous feedback
beep
operation on a page element. - Shorthand name:
KeymanWeb.KBR
context
Function (Deprecated)- Gets
context
for an ongoing keyboard operation relative to the caret's present position. - Shorthand name:
KeymanWeb.KC
contextMatch
Function (Deprecated)- Context matching: Returns
true
if the specifiedcontext
call matches a provided string. - Shorthand name:
KeymanWeb.KCM
deadkeyMatch
Function (Deprecated)- Deadkey matching: Seeks to match the
deadkey
statedk
at the relative caret positionn
. - Shorthand name:
KeymanWeb.KDM
deadkeyOutput
Function- Deadkey output: Associates the
deadkey
statedk
with the element at the current caret position, after overwritingnd
characters. - Shorthand name:
KeymanWeb.KDO
deleteContext
Function- Context deletion - removes the specified number of deadkeys and characters from the left of the caret.
- Shorthand name:
KeymanWeb.KDC
fullContextMatch
Function- Context matching: Returns
true
if the current context matches the specified rule context specification. - Shorthand name:
KeymanWeb.KFCM
ifStore
FunctionifStore
compares the content of a systemstore
with a string value.- Shorthand name:
KeymanWeb.KIFS
indexOutput
Function- Index-based output: Outputs a mapped character according to a previous selection from a
keyman.interface.any()
call upon astore
string, after deletingnd
characters. - Shorthand name:
KeymanWeb.KIO
insertText
Function- Inserts a text string and optional
deadkey
into the active output element. - Shorthand name:
KeymanWeb.KT
isKeypress
Function- Returns
true
if the input event corresponds to a keypress event resulting in character output. - Shorthand name:
KeymanWeb.KIK
keyInformation
Function- Returns an object with extended information about a specified keystroke event.
- Shorthand name:
KeymanWeb.KKI
keyMatch
Function- Keystroke matching: Returns
true
if the event matches the rule's shift mask and key code. - Shorthand name:
KeymanWeb.KKM
loadStore
Function- Load an option
store
value from a cookie or default value if no prior stored value exists. - Shorthand name:
KeymanWeb.KLOAD
nul
Functionnul
context check: Returnstrue
if the length of thecontext
is less than or equal ton
characters.- Shorthand name:
KeymanWeb.KN
output
Function- Outputs the specified string to an element, overwriting characters before the caret if specified.
- Shorthand name:
KeymanWeb.KO
registerKeyboard
Function- Register the keyboard stub and load the keyboard.
- Shorthand name:
KeymanWeb.KR
registerStub
Function- Register the keyboard stub, return true if already registered.
- Shorthand name:
KeymanWeb.KRS
saveFocus
Function- Save focus: Temporarily saves keyboard processing data for the currently-focused control.
- Shorthand name:
KeymanWeb.KSF
saveStore
Function- Save an option
store
value to a cookie for the active keyboard. - Shorthand name:
KeymanWeb.KSAVE
setStore
FunctionsetStore
sets the value of a systemstore
to a string.- Shorthand name:
KeymanWeb.KSETS
stateMatch
Function- State-key matching: Returns
true
if the event matches the rule's state-key requirements. - Shorthand name:
KeymanWeb.KSM