KeyboardLayoutMap:size 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
KeyboardLayoutMap
接口的 size
只读属性返回映射中的元素数量。
该属性与 Map.prototype.size
相似。
值
一个数字。
示例
以下示例获取英文 QWERTY 键盘上位置或布局特定字符串及其关联键盘代码的数量。
js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
console.log(keyboardLayoutMap.size);
});
规范
Specification |
---|
ECMAScript® 2025 Language Specification # sec-get-map.prototype.size |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
size |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.