diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md b/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md
old mode 100644
new mode 100755
index 60d5fdca087871335471341d8cca934fc527cebb..c4d8f541b08c72a7f13597b236441b4340b6a5c5
--- a/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md
@@ -1,5 +1,6 @@
# 组合按键
+InputConsumer模块提供对按键事件的监听。
>  **说明:**
>
@@ -22,23 +23,23 @@ on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): v
开始监听组合按键事件, 当满足条件的组合按键输入事件发生时,将KeyOptions回调到入参callback表示的回调函数上。
-**系统能力:** SystemCapability.MultimodalInput.Input.InputConsumer
+此接口为系统接口。
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 监听输入事件类型,只支持“key”。 |
-| keyOptions | [KeyOptions](#keyoption) | 是 | 组合键选项,用来指定组合键输入时应该符合的条件。 |
-| callback | Callback<KeyOptions> | 是 | 回调函数。当满足条件的按键输入产生时,回调到此函数,以传入的keyOptions为入参。 |
+| keyOptions | [keyOptions](#keyOptions) | 是 | 组合键选项,用来指定组合键输入时应该符合的条件。 |
+| callback | Callback<KeyOptions> | 是 | 回调函数。当满足条件的按键输入产生时,回调到此函数,以传入的KeyOptions为入参。 |
**示例:**
```
-let keyOptions = { preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0 }
-let callback = function (keyOptions) {
- console.info("preKeys: " + keyOptions.preKeys, "finalKey: " + keyOptions.finalKey,
- "isFinalKeyDown: " + keyOptions.isFinalKeyDown, "finalKeyDownDuration: " + keyOptions.finalKeyDownDuration)
+let keyOptions = {preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0}
+let callback = function(keyOptions) {
+ console.info("preKeys: " + keyOptions.preKeys, "finalKey: " + keyOptions.finalKey,
+ "isFinalKeyDown: " + keyOptions.isFinalKeyDown, "finalKeyDownDuration: " + keyOptions.finalKeyDownDuration)
}
inputConsumer.on('key', keyOptions, callback);
```
@@ -46,10 +47,12 @@ inputConsumer.on('key', keyOptions, callback);
## inputConsumer.off
-off(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void
+off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void
停止监听组合按键事件。
+此接口为系统接口。
+
**系统能力:** SystemCapability.MultimodalInput.Input.InputConsumer
**参数:**
@@ -57,16 +60,16 @@ off(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>):
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 监听输入事件类型,只支持“key”。 |
-| keyOptions | [KeyOptions](#keyoption) | 是 | 开始监听时传入的KeyOptions。 |
-| callback | Callback<KeyOptions> | 是 | 开始监听时与KeyOptions一同传入的回调函数 。 |
+| keyOptions | [keyOptions](#keyOptions) | 是 | 开始监听时传入的keyOptions。 |
+| callback | Callback<KeyOptions> | 是 | 开始监听时与KeyOption一同传入的回调函数 。 |
**示例:**
```
-let keyOptions = { preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0 }
-let callback = function (keyOptions) {
- console.info("preKeys: " + keyOptions.preKeys, "finalKey: " + keyOptions.finalKey,
- "isFinalKeyDown: " + keyOptions.isFinalKeyDown, "finalKeyDownDuration: " + keyOptions.finalKeyDownDuration)
+let keyOptions = {preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0}
+let callback = function(keyOptions) {
+ console.info("preKeys: " + keyOptions.preKeys, "finalKey: " + keyOptions.finalKey,
+ "isFinalKeyDown: " + keyOptions.isFinalKeyDown, "finalKeyDownDuration: " + keyOptions.finalKeyDownDuration)
}
inputConsumer.off('key', keyOptions, callback);
```
@@ -76,9 +79,11 @@ inputConsumer.off('key', keyOptions, callback);
组合键输入事件发生时,组合键满足的选项。
-**系统能力:** 以下各项对应系统能力均为SystemCapability.MultimodalInput.Input.InputConsumer
+此接口为系统接口。
-| 参数 | 类型 | 必填 | 说明 |
+**系统能力:**SystemCapability.MultimodalInput.Input.InputConsumer
+
+ | 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| preKeys | Array | 是 | 组合键前置按键集合,可为空,前置按键无顺序要求。 |
| finalKey | Number | 是 | 组合键最后按键,不能为空。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
old mode 100644
new mode 100755
index b6e8be396fd02a0f7d050942ab220ecf629efb83..9c727e3223068e563b5764ff92b588b720db92bb
--- a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md
@@ -4,8 +4,7 @@
输入设备管理模块,用于监听输入设备连接、断开和变化,并查看输入设备相关信息。比如监听鼠标插拔,并获取鼠标的id、name和指针移动速度等信息。
-> **说明:**
->
+> **说明**:
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
@@ -23,16 +22,15 @@ getDeviceIds(callback: AsyncCallback<Array<number>>): void
获取所有输入设备的id列表,使用callback方式作为异步方法。
-**系统能力:** SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
-**参数:**
+**参数**:
| 参数 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----- |
| callback | AsyncCallback<Array<number>> | 是 | 回调函数。 |
-
-**示例:**
+**示例**:
```js
inputDevice.getDeviceIds((ids)=>{
@@ -42,19 +40,19 @@ inputDevice.getDeviceIds((ids)=>{
## inputDevice.getDeviceIds
-function getDeviceIds(): Promise>
+getDeviceIds(): Promise<Array<number>>
获取所有输入设备的id列表,使用Promise方式作为异步方法。
-**系统能力:** SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
-**返回值:**
+**返回值**:
-| 参数 | 说明 |
-| ------------------------ | ------------------ |
-| Promise\> | Promise实例,用于异步获取结果 |
+| 参数 | 说明 |
+| ---------------------------------- | ------------------- |
+| Promise<Array<number>> | Promise实例,用于异步获取结果。 |
-**示例:**
+**示例**:
```js
inputDevice.getDeviceIds().then((ids)=>{
@@ -68,16 +66,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信息。
@@ -88,19 +86,25 @@ inputDevice.getDevice(1, (inputDevice)=>{
## inputDevice.getDevice
-function getDevice(deviceId: number): Promise\
+getDevice(deviceId: number): Promise<InputDeviceData>
获取输入设备的描述信息,使用Promise方式作为异步方法。
-**系统能力:** SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
+
+**参数**:
+
+| 参数 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ------------ |
+| deviceId | number | 是 | 需要获取信息的设备id。 |
-**返回值:**
+**返回值**:
-| 参数 | 说明 |
-| ------------------------- | ------------------ |
-| Promise\ | Promise实例,用于异步获取结果 |
+| 参数 | 说明 |
+| ---------------------------------------- | ------------------- |
+| Promise<[InputDeviceData](#inputdevicedata)> | Promise实例,用于异步获取结果。 |
-**示例:**
+**示例**:
```js
// 示例获取设备id为1的设备name信息。
@@ -115,30 +119,30 @@ inputDevice.getDevice(1).then((inputDevice)=>{
输入设备的描述信息。
-**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
-| 名称 | 参数类型 | 说明 |
-| ---------- | -------------------------------------- | ---------------------------------------- |
-| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
-| name | string | 输入设备的名字。 |
-| sources | Array<[SourceType](#sourcetype)> | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 |
-| axisRanges | Array<[axisRanges](#axisrange)> | 输入设备的轴信息。 |
-| bus | number | 输入设备的总线类型。 |
-| product | number | 输入设备的产品信息。 |
-| vendor | number | 输入设备的厂商信息。 |
-| version | number | 输入设备的版本信息。 |
-| phys | string | 输入设备的物理地址。 |
-| uniq | string | 输入设备的唯一标识。 |
+| 名称 | 参数类型 | 说明 |
+| -------------------- | -------------------------------------- | ---------------------------------------- |
+| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
+| name | string | 输入设备的名字。 |
+| sources | Array<[SourceType](#sourcetype)> | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 |
+| axisRanges | Array<[axisRanges](#axisrange)> | 输入设备的轴信息。 |
+| bus9+ | number | 输入设备的总线类型。 |
+| product9+ | number | 输入设备的产品信息。 |
+| vendor9+ | number | 输入设备的厂商信息。 |
+| version9+ | number | 输入设备的版本信息。 |
+| phys9+ | string | 输入设备的物理地址。 |
+| uniq9+ | string | 输入设备的唯一标识。 |
-## AxisType
+## AxisType9+
-输入设备的轴类型,为'Null'。
+输入设备的轴类型。
## AxisRange
输入设备的轴信息。
-**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**: 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ------ | ------------------------- | -------- |
@@ -151,9 +155,9 @@ inputDevice.getDevice(1).then((inputDevice)=>{
## SourceType
-定义轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的源就是鼠标。
+定义这个轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的源就是鼠标。
-**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
+**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------- | ------ | ----------- |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md b/zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md
old mode 100644
new mode 100755
index 9b5ea5c1c5f77b6eecb9035331355170b3980826..d199635658c38b565315bc9b0e760b8e67ba0cee
--- a/zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md
@@ -1,11 +1,12 @@
# 注入按键
+InputEventClient模块提供了注入按键能力。
> **说明:**
>
-> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
-> 本模块接口均为系统接口,三方应用不支持调用。
+> - 本模块接口均为系统接口,三方应用不支持调用。
## 导入模块
@@ -22,6 +23,8 @@ injectEvent({KeyEvent: KeyEvent}): void
注入按键,KeyEvent为注入按键的描述信息。
+此接口为系统接口。
+
**系统能力:** SystemCapability.MultimodalInput.Input.InputSimulator
**参数:**
@@ -47,11 +50,13 @@ let res = inputEventClient.injectEvent({KeyEvent: keyEvent});
注入按键的描述信息
+此接口为系统接口。
+
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputSimulator
| 参数 | 类型 | 必填 | 说明 |
| --------------- | ------- | ---- | --------- |
| isPressed | boolean | 是 | 按键是否按下 |
-| keyCode | Number | 是 | 按键键值 |
-| keyDownDuration | boolean | 是 | 按键按下持续时间 |
-| isIntercepted | Number | 是 | 按键是否可以被拦截 |
+| keyCode | number | 是 | 按键键值 |
+| keyDownDuration | number | 是 | 按键按下持续时间 |
+| isIntercepted | boolean | 是 | 按键是否可以被拦截 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
old mode 100644
new mode 100755
index 72843e68c3d0e1de8e92c5fc42c51128bd2a72b8..b908f75494042df7f25528bf2244793c5b592487
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
@@ -1,5 +1,6 @@
# 输入监听
+InputMonitor模块提供了监听全局触摸事件的功能。
>  **说明:**
> - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
@@ -10,7 +11,7 @@
## 导入模块
-```
+```js
import inputMonitor from '@ohos.multimodalInput.inputMonitor';
```
@@ -24,92 +25,59 @@ ohos.permission.INPUT_MONITORING
on(type: "touch", receiver: TouchEventReceiver): void
-开始监听全局输入。
+开始监听全局触屏事件。
+
+此接口为系统接口。
**需要权限:**ohos.permission.INPUT_MONITORING
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
-| 参数 | 类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | -------------------- |
-| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
-| receiver | [TouchEventReceiver](#toucheventreceiver) | 是 | 触摸输入事件回调函数。 |
+| 参数 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------- | ---- | ------------------------------- |
+| type | string | 是 | 监听输入事件类型,取值“touch”。 |
+| receiver | [TouchEventReceiver](#toucheventreceiver) | 是 | 触摸输入事件回调函数。 |
**示例:**
-```
-export default {
- callback: function (value) {
- if (checkEvent(value)) {
- //事件满足业务要求,事件被消费
- return true;
- } else {
- //事件不满足业务要求,事件未被消费
- return false;
- }
- },
- testOn: function () {
- console.info("InputMonitorJsTest---start---testOn");
- inputMonitor.on(
- "touch",
- this.callback
- );
- console.info("InputMonitorJsTest---end---testOn");
- }
-}
+```js
+inputMonitor.off("touch", (event) => {
+ // 消费触屏事件
+ return false;
+});
```
-
## inputMonitor.off
off(type: "touch", receiver?: TouchEventReceiver): void
-停止监听全局输入。
+停止监听全局触屏事件。
+
+此接口为系统接口。
**需要权限:**ohos.permission.INPUT_MONITORING
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
-| 参数 | 类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | -------------------- |
-| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
-| receiver | [TouchEventReceiver](#toucheventreceiver) | 否 | 触摸输入事件回调函数。 |
+| 参数 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------- | ---- | ------------------------------- |
+| type | string | 是 | 监听输入事件类型,取值“touch”。 |
+| receiver | [TouchEventReceiver](#toucheventreceiver) | 否 | 触摸输入事件回调函数。 |
**示例:**
-```
-export default {
- callback: function (value) {
- if (checkEvent(value)) {
- //事件满足业务要求,事件被消费
- return true;
- } else {
- //事件不满足业务要求,事件未被消费
- return false;
- }
- },
- testOff: function () {
- console.info("InputMonitorJsTest---start---testOff");
- inputMonitor.off(
- "touch",
- this.callback
- );
- console.info("InputMonitorJsTest---end---testOff");
- }
- }
+```js
+inputMonitor.off("touch");
```
## TouchEventReceiver
-触摸输入事件的回调函数,如果返回true,则触摸输入将被监听器消耗(系统执行关闭动作)。
-
+触摸输入事件的回调函数。如果返回true,则触摸输入被监听器消耗,系统将执行关闭动作。
-### (touchEvent: TouchEvent): Boolean
-
-触摸输入事件的回调函数。函数名由使用者定义,这里是函数调用时必须符合的格式,传入参数必须为TouchEvent类型,返回值为Boolean类型。
+此接口为系统接口。
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
@@ -119,30 +87,16 @@ export default {
| touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | 是 | 触摸输入事件回调函数,返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
**返回值:**
-| 类型 | 说明 |
+| 类型 | 说明 |
| ------- | -------------------------------------- |
-| Boolean | 返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
+| Boolean | 返回true表示触摸输入事件被监听器消费,false表示触摸输入事件未被监听器消费。 |
**示例:**
-```
-export default {
- callback: function (value) { //此处为(touchEvent:TouchEvent): Boolean 方法的实现
- if (checkEvent(value)) {
- //事件满足业务要求,事件被消费
- return true;
- } else {
- //事件不满足业务要求,事件未被消费
- return false;
- }
- },
- testOff: function () {
- console.info("InputMonitorJsTest---start---testOff");
- inputMonitor.off(
- "touch",
- this.callback
- );
- console.info("InputMonitorJsTest---end---testOff");
- }
-}
+```js
+inputMonitor.on("touch", (event) => {
+ // 消费触摸输入事件
+ return false;
+});
+inputMonitor.off("touch");
```