Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
840ee27f
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
840ee27f
编写于
6月 06, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 06, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4951 【OpenHarmony开源贡献者计划2022】InputDevice中文API相关格式及表达问题
Merge pull request !4951 from king_he/0602-b
上级
d2b93a9c
167089e5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
54 deletion
+54
-54
zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
+54
-54
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
浏览文件 @
840ee27f
...
...
@@ -4,7 +4,7 @@
输入设备管理模块,用于监听输入设备连接、断开和变化,并查看输入设备相关信息。比如监听鼠标插拔,并获取鼠标的id、name和指针移动速度等信息。
>
 **说明:**
>
**说明**:<br>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...
...
@@ -21,16 +21,16 @@ on(type: “change”, listener: Callback<DeviceListener>): void
监听设备的热插拔事件。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- |
| type | string | 是 | 输入设备的事件类型
|
| listener | Callback
<
[DeviceListener](#devicelistener
<sup>
9+
</sup>
)
>
| 是 | 可上报的输入设备事件 |
| type | string | 是 | 输入设备的事件类型
。
|
| listener | Callback
<
[DeviceListener](#devicelistener
<sup>
9+
</sup>
)
>
| 是 | 可上报的输入设备事件
。
|
**示例
:**
**示例
**
:
```
js
let
isPhysicalKeyboardExist
=
true
;
...
...
@@ -56,16 +56,16 @@ off(type: “change”, listener?: Callback<DeviceListener>): void
取消监听设备的热插拔事件。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- |
| type | string | 是 | 输入设备的事件类型
|
| listener | Callback
<
[DeviceListener](#devicelistener
<sup>
9+
</sup>
)
>
| 否 | 可上报的输入设备事件 |
| type | string | 是 | 输入设备的事件类型
。
|
| listener | Callback
<
[DeviceListener](#devicelistener
<sup>
9+
</sup>
)
>
| 否 | 可上报的输入设备事件
。
|
**示例
:**
**示例
**
:
```
js
listener
:
function
(
data
)
{
...
...
@@ -75,9 +75,9 @@ listener: function(data) {
// 单独取消listener的监听。
inputDevice
.
off
(
"
change
"
,
this
.
listener
);
// 取消所有监听
// 取消所有监听
。
inputDevice
.
off
(
"
change
"
);
// 取消监听后,软键盘默认都弹出
// 取消监听后,软键盘默认都弹出
。
```
## inputDevice.getDeviceIds
...
...
@@ -86,15 +86,15 @@ getDeviceIds(callback: AsyncCallback<Array<number>>): void
获取所有输入设备的id列表,使用callback方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数
| 类型 | 必填 | 说明 |
| 参数 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----- |
| callback | AsyncCallback
<
Array
<
number
>>
| 是
| 回调函数。 |
| callback | AsyncCallback
<
Array
<
number
>>
| 是 | 回调函数。 |
**示例
:**
**示例
**
:
```
js
inputDevice
.
getDeviceIds
((
ids
)
=>
{
...
...
@@ -108,15 +108,15 @@ function getDeviceIds(): Promise<<Array<number>>
获取所有输入设备的id列表,使用Promise方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**返回值
:**
**返回值
**
:
| 参数 | 说明 |
| ------------------------- | ----------------------------- |
| Promise
<
Array
<
number
>>
| Promise实例,用于异步获取结果 |
| Promise
<
Array
<
number
>>
| Promise实例,用于异步获取结果
。
|
**示例
:**
**示例
**
:
```
js
inputDevice
.
getDeviceIds
().
then
((
ids
)
=>
{
...
...
@@ -130,16 +130,16 @@ getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): voi
获取输入设备的描述信息,使用callback方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------------------------- |
| deviceId | number | 是 | 需要获取信息的设备id。 |
| callback | AsyncCallback
<
[InputDeviceData](#inputdevicedata)
>
| 是 | 回调函数,异步返回InputDeviceData对象。 |
**示例
:**
**示例
**
:
```
js
// 示例获取设备id为1的设备name信息。
...
...
@@ -154,21 +154,21 @@ function getDevice(deviceId: number): Promise<InputDeviceData>
获取输入设备的描述信息,使用Promise方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| deviceId | number | 是 | 需要获取信息的设备id。 |
**返回值
:**
**返回值
**
:
| 参数 | 说明 |
| -------------------------------------------------- | ----------------------------- |
| Promise
<
[InputDeviceData](#inputdevicedata)
>
| Promise实例,用于异步获取结果 |
| Promise
<
[InputDeviceData](#inputdevicedata)
>
| Promise实例,用于异步获取结果
。
|
**示例
:**
**示例
**
:
```
js
// 示例获取设备id为1的设备name信息。
...
...
@@ -181,11 +181,11 @@ inputDevice.getDevice(1).then((inputDevice)=>{
supportKeys(deviceId: number, keys: Array
<
KeyCode
>
, callback: Callback
<
Array
<
boolean
>>
): void;
获取输入设备
的描述信息
,使用callback方式作为异步方法。
获取输入设备
支持的键码值
,使用callback方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ |
...
...
@@ -193,7 +193,7 @@ supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<
| keys | Array
<
KeyCode
>
| 是 | 需要查询的键码值,最多支持5个按键查询。 |
| callback | Callback
<
Array
<
boolean
>>
| 是 | 回调函数,异步返回查询结果。 |
**示例
:**
**示例
**
:
```
js
// 示例查询id为1的设备对于17、22和2055按键的支持情况。
...
...
@@ -206,24 +206,24 @@ inputDevice.supportKeys(1, [17, 22, 2055], (ret)=>{
supportKeys(deviceId: number, keys: Array
<
KeyCode
>
): Promise
<
Array
<
boolean
>>
;
获取输入设备
的描述信息
,使用Promise方式作为异步方法。
获取输入设备
支持的键码值
,使用Promise方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| keys | Array
<
KeyCode
>
| 是 | 需要查询的键码值,最多支持5个按键查询。 |
**返回值
:**
**返回值
**
:
| 参数 | 说明 |
| ----------------------------------- | ----------------------------- |
| Promise
<
Array
<
boolean
>>
| Promise实例,用于异步获取结果 |
| Promise
<
Array
<
boolean
>>
| Promise实例,用于异步获取结果
。
|
**示例
:**
**示例
**
:
```
js
// 示例查询id为1的设备对于17、22和2055按键的支持情况。
...
...
@@ -238,16 +238,16 @@ getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>):
查询输入设备的键盘类型,使用callback方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**参数
:**
**参数
**
:
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| callback | AsyncCallback
<
[KeyboardType](#keyboardtype)
>
| 是 | 回调函数,异步返回查询结果。 |
**示例
:**
**示例
**
:
```
js
// 示例查询设备id为1的设备键盘类型。
...
...
@@ -262,15 +262,15 @@ getKeyboardType(deviceId: number,): Promise<KeyboardType>;
查询输入设备的键盘类型,使用Promise方式作为异步方法。
**系统能力
:**
SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
SystemCapability.MultimodalInput.Input.InputDevice
**返回值
:**
**返回值
**
:
| 参数 | 说明 |
| -------------------------------------------- | ----------------------------- |
| Promise
<
[KeyboardType](#keyboardtype)
>
| Promise实例,用于异步获取结果 |
| Promise
<
[KeyboardType](#keyboardtype)
>
| Promise实例,用于异步获取结果
。
|
**示例
:**
**示例
**
:
```
js
// 示例查询设备id为1的设备键盘类型。
...
...
@@ -283,7 +283,7 @@ inputDevice.getKeyboardType().then((ret)=>{
输入设备的描述信息。
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------- | --------------------------- | ------------------------------------------------------------ |
...
...
@@ -294,7 +294,7 @@ inputDevice.getKeyboardType().then((ret)=>{
输入设备的描述信息。
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------------------- | -------------------------------------- | ------------------------------------------------------------ |
...
...
@@ -313,7 +313,7 @@ inputDevice.getKeyboardType().then((ret)=>{
输入设备的轴类型
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------- | -------- | ------------------- |
...
...
@@ -331,7 +331,7 @@ inputDevice.getKeyboardType().then((ret)=>{
输入设备的轴信息
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------------------- | ------------------------- | ---------------- |
...
...
@@ -347,7 +347,7 @@ inputDevice.getKeyboardType().then((ret)=>{
定义这个轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的源就是鼠标。
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------- | ------ | ----------- |
...
...
@@ -362,7 +362,7 @@ inputDevice.getKeyboardType().then((ret)=>{
定义监听设备热插拔事件。
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ------ | -------- | ------------------ |
...
...
@@ -373,7 +373,7 @@ inputDevice.getKeyboardType().then((ret)=>{
定义键盘输入设备的类型。
**系统能力
:**
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
**系统能力
**
:
以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 值 | 说明 |
| ------------------- | -------- | ---- | ------------------ |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录