KeyboardLayoutMap: phương thức values()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Phương thức values() của giao diện KeyboardLayoutMap trả về một đối tượng Iterator mới chứa các giá trị cho mỗi chỉ mục trong đối tượng KeyboardLayoutMap.
Phương thức này giống với Map.prototype.values().
Cú pháp
js
values()
Tham số
Không có.
Giá trị trả về
Một đối tượng Iterator mới.
Ví dụ
Ví dụ sau lặp qua mỗi chuỗi theo vị trí hoặc bố cục cụ thể trên bàn phím QWERTY tiếng Anh.
js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
for (const key of keyboardLayoutMap.values()) {
console.log(`${key} key`);
}
});
Thông số kỹ thuật
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-map.prototype.values> |