State-key matching: Returns
true if the event matches the rule's state-key requirements.
KeymanWeb.KSM(e, shiftCode); // Shorthand
- A keystroke-related event object to match.
- The state-key bitflags the event should match.
trueif the keystroke matches the desired states, otherwise
As of KeymanWeb 10.0, KeymanWeb now supports keyboard rules conditioned upon 'state keys' like Caps Lock if specified
by keyboard developers. The
stateMatch function examines the bit-flags to determine the state keys being tested and compares
the keyboard event against them as appropriate. As such, it is designed to be a condition check alongside
For comparison with Developer 'rules' from keyboard source code, in the rule
+ [CAPS K_A] > 'BIG A' + [NCAPS K_A] > 'small a'
a keyboard would check which rule the triggering keystroke (
"a") matches by using
from within a raised keystroke event with object
e, which checks that the keystroke represented by
has an activated Caps Lock state as represented by the code 0x0100. The NCAPS rule would instead compare against 0x0200.
keyman.interface.stateMatch() receives an event object as one of its parameters, it does not need a direct link to the
element receiving input.