Instance properties
KeyboardLayoutMap.sizeRead only-
Returns the number of elements in the
KeyboardLayoutMapobject.
Instance methods
KeyboardLayoutMap[Symbol.iterator]()-
Returns a new Iterator object that contains the key/value pairs.
KeyboardLayoutMap.entries()-
Returns a new Iterator object that contains the key/value pairs.
KeyboardLayoutMap.forEach()-
Executes a provided function once for each element of
KeyboardLayoutMap. KeyboardLayoutMap.get()-
Returns the element with the given key from the
KeyboardLayoutMapobject. KeyboardLayoutMap.has()-
Returns a boolean indicating whether the
KeyboardLayoutMapobject has an element with the specified key. KeyboardLayoutMap.keys()-
Returns a new Iterator object that contains the keys for each index in the
KeyboardLayoutMapobject. KeyboardLayoutMap.values()-
Returns a new Iterator object that contains the values for each index in the
KeyboardLayoutMapobject.
Examples
The following example demonstrates how to get the location- or layout-specific string associated with the keyboard code that corresponds to the 'W' key on an English QWERTY keyboard.
js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
const upKey = keyboardLayoutMap.get("KeyW");
window.alert(`Press ${upKey} to move up.`);
});
Specifications
| Specification |
|---|
| Keyboard Map # keyboardlayoutmap |