KeyboardLayoutMap: values() Methode

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.

Die values() Methode des KeyboardLayoutMap Interfaces gibt ein neues Iterator-Objekt zurück, das die Werte für jeden Index im KeyboardLayoutMap Objekt enthält.

Die Methode ist ansonsten identisch mit Map.prototype.values().

Syntax

js
values()

Rückgabewert

Ein neues Iterator-Objekt.

Beispiele

Das folgende Beispiel durchläuft jeden orts- oder layoutspezifischen String auf einer englischen QWERTY-Tastatur.

js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
  for (const key of keyboardLayoutMap.values()) {
    console.log(`${key} key`);
  }
});

Spezifikationen

Specification
ECMAScript® 2025 Language Specification
# sec-map.prototype.values

Browser-Kompatibilität

BCD tables only load in the browser

Siehe auch