提交 e49a41c8 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 2b817254
master OpenHarmony-3.2-Beta2 OpenHarmony-3.2-Beta3 OpenHarmony-3.2-Beta4 OpenHarmony-3.2-Beta5 OpenHarmony-3.2-Release OpenHarmony-4.0-Beta1 OpenHarmony-4.0-Beta2 bak_OpenHarmony-4.0-Beta1_20230529 docs-modify feature_IDL_20220811 monthly_20220816 monthly_20221018 monthly_20230815 revert-merge-17651-master revert-merge-19334-OpenHarmony-4.0-Beta1 revert-merge-19586-master revert-merge-20613-master revert-merge-21757-OpenHarmony-4.0-Beta2 revert-merge-21765-OpenHarmony-4.0-Beta2 revert-merge-23766-master weekly_20220712 weekly_20220719 weekly_20220726 weekly_20220802 weekly_20220809 weekly_20220816 weekly_20220823 weekly_20220830 weekly_20220906 weekly_20220913 weekly_20220920 weekly_20220927 weekly_20221004 weekly_20221011 weekly_20221018 weekly_20221025 weekly_20221101 weekly_20221108 weekly_20221115 weekly_20221122 weekly_20221129 weekly_20221206 weekly_20221213 weekly_20221220 weekly_20221227 weekly_20230103 weekly_20230110 weekly_20230117 weekly_20230124 weekly_20230131 weekly_20230207 weekly_20230214 weekly_20230221 weekly_20230228 weekly_20230307 weekly_20230314 weekly_20230321 weekly_20230328 weekly_20230404 weekly_20230411 weekly_20230418 weekly_20230425 weekly_20230502 weekly_20230509 weekly_20230516 weekly_20230523 weekly_20230530 weekly_20230606 weekly_20230613 weekly_20230619 weekly_20230626 weekly_20230627 weekly_20230704 weekly_20230712 weekly_20230725 weekly_20230801 weekly_20230808 weekly_20230815 weekly_20230822 weekly_20230829 weekly_20230905 OpenHarmony-v4.0-Beta2 OpenHarmony-v4.0-Beta1 OpenHarmony-v3.2.3-Release OpenHarmony-v3.2.2-Release OpenHarmony-v3.2.1-Release OpenHarmony-v3.2-Release OpenHarmony-v3.2-Beta5 OpenHarmony-v3.2-Beta4 OpenHarmony-v3.2-Beta3 OpenHarmony-v3.2-Beta2
无相关合并请求
# Combination Key
# Input Consumer
The Input Consumer module implements listening for key events.
> **NOTE**<br>
>
......@@ -18,19 +19,21 @@ import inputConsumer from '@ohos.multimodalInput.inputConsumer';
## inputConsumer.on
on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void
on(type: "key", keyOptions: KeyOptions, callback: Callback&lt;KeyOptions&gt;): void
Enables listening for combination key events. When a combination key event that meets the specified conditions occurs, **keyOptions** will be passed as an input parameter to **callback**.
This is a system API.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the key input event to listen for. Only **key** is supported.|
| keyOptions | [keyOptions](#keyOptions) | Yes| Key option, which specifies the condition for combination key input.|
| callback | KeyOptions | Yes| Callback used to return the result.<br> When a key input event that meets the specified options occurs, **keyOptions** will be passed as an input parameter to **callback**.|
| type | string | Yes| Type of the key input event to listen for. Only **key** is supported.|
| keyOptions | [keyOptions](#keyOptions) | Yes| Key option, which specifies the condition for combination key input.|
| callback | Callback&lt;KeyOptions&gt; | Yes| Callback used to return the result.<br> When a key input event that meets the specified options occurs, **keyOptions** will be passed as an input parameter to **callback**.|
**Example**
......@@ -46,10 +49,12 @@ inputConsumer.on('key', keyOptions, callback);
## inputConsumer.off
off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void
off(type: "key", keyOptions: KeyOptions, callback?: Callback&lt;KeyOptions&gt;): void
Stops listening for combination key events.
This is a system API.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
**Parameters**
......@@ -58,7 +63,7 @@ Stops listening for combination key events.
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the key input event to listen for. Only **key** is supported.|
| keyOptions | [keyOptions](#keyOptions) | Yes| Key options passed to the key input event when listening starts.|
| callback | Callback<KeyOptions> | Yes| Callback function passed to the key input event with **keyOptions** when listening starts.|
| callback | Callback&lt;KeyOptions&gt; | Yes| Callback function passed to the key input event with **keyOptions** when listening starts.|
**Example**
......@@ -76,6 +81,8 @@ inputConsumer.off('key', keyOptions, callback);
Defines the key options that are met when a combination key input event occurs.
This is a system API.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
**Parameters**
......
# Input Device
The input device management module is used to listen for the connection, disconnection, and updates of input devices and display information about input devices. For example, it can be used to listen for mouse insertion and removal and obtain information such as the ID, name, and pointer speed of the mouse.
The Input Device module implements listening for connection, disconnection, and update events of input devices and displays information about input devices. For example, it can be used to listen for mouse insertion and removal and obtain information such as the ID, name, and pointer speed of the mouse.
> **NOTE**<br>
......@@ -179,7 +179,7 @@ inputDevice.getDevice(1).then((inputDevice)=>{
## inputDevice.supportKeys<sup>9+</sup>
supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;Array&lt;boolean&gt;&gt;): void;
supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;Array&lt;boolean&gt;&gt;): void
Obtains the key codes supported by the input device. This API uses an asynchronous callback to return the result.
......@@ -204,7 +204,7 @@ inputDevice.supportKeys(1, [17, 22, 2055], (ret)=>{
## inputDevice.supportKeys<sup>9+</sup>
supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;boolean&gt;&gt;;
supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;boolean&gt;&gt;
Obtains the key codes supported by the input device. This API uses a promise to return the result.
......@@ -234,7 +234,7 @@ inputDevice.supportKeys(1, [17, 22, 2055]).then((ret)=>{
## inputDevice.getKeyboardType<sup>9+</sup>
getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void;
getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void
Obtains the keyboard type of an input device. This API uses an asynchronous callback to return the result.
......@@ -258,7 +258,7 @@ inputDevice.getKeyboardType(1, (ret)=>{
## inputDevice.getKeyboardType<sup>9+</sup>
getKeyboardType(deviceId: number,): Promise&lt;KeyboardType&gt;;
getKeyboardType(deviceId: number,): Promise&lt;KeyboardType&gt;
Obtains the keyboard type of an input device. This API uses a promise to return the result.
......
# Input Event
The Input Event module describes basic events reported by an input device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -9,6 +11,8 @@
import InputEvent from '@ohos.multimodalInput.inputEvent';
```
## InputEvent
**System capability**: SystemCapability.MultimodalInput.Input.Core
**Parameters**
......
# Key Injection
The Key Injection module implements injection of key events.
> **NOTE**<br>
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module are system APIs and cannot be called by third-party applications.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
......@@ -22,6 +23,8 @@ injectEvent({KeyEvent: KeyEvent}): void
Injects a key event.
This is a system API.
**System capability**: SystemCapability.MultimodalInput.Input.InputSimulator
**Parameters**
......@@ -54,6 +57,6 @@ Defines the information about the key event to inject.
| Name | Type | Mandatory | Description |
| --------------- | ------- | ---- | --------- |
| isPressed | boolean | Yes | Whether the key is pressed. |
| keyCode | Number | Yes | Key code. |
| keyDownDuration | boolean | Yes | Duration within which the key is pressed. |
| isIntercepted | Number | Yes | Whether the key can be intercepted.|
| keyCode | number | Yes | Key code. |
| keyDownDuration | number | Yes | Duration within which the key is pressed. |
| isIntercepted | boolean | Yes | Whether the key can be intercepted.|
# Input Monitor
The Input Monitor module implements listening for global touch events.
> **NOTE**<br>
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -26,6 +27,8 @@ on(type: "touch", receiver: TouchEventReceiver): void
Enables listening for global touch events.
This is a system API.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
......@@ -46,10 +49,12 @@ inputMonitor.off("touch", (event) => {
});
```
on(type: "mouse", receiver:Callback<MouseEvent>):void
on(type: "mouse", receiver: Callback&lt;MouseEvent&gt;): void
Enables listening for global mouse events.
This is a system API.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
......@@ -59,7 +64,7 @@ Enables listening for global mouse events.
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------------- |
| type | string | Yes | Type of the input event to listen for. The value is **mouse**.|
| receiver | Callback<MouseEvent> | Yes | Callback used to return the mouse event. |
| receiver | Callback&lt;MouseEvent&gt; | Yes | Callback used to return the mouse event. |
**Example**
......@@ -73,10 +78,12 @@ inputMonitor.off("mouse", (event) => {
## inputMonitor.off
off(type: "touch", receiver?:TouchEventReceiver):void
off(type: "touch", receiver?: TouchEventReceiver): void
Stops listening for global touch events.
This is a system API.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
......@@ -98,6 +105,8 @@ off(type: "mouse", receiver?:Callback<MouseEvent>):void
Stops listening for global mouse events.
This is a system API.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
......@@ -107,7 +116,7 @@ Stops listening for global mouse events.
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------------- |
| type | string | Yes | Type of the input event to listen for. The value is **mouse**.|
| receiver | Callback<MouseEvent> | No | Callback used to return the mouse event. |
| receiver | Callback&lt;MouseEvent&gt; | No | Callback used to return the mouse event. |
**Example**
......@@ -119,12 +128,9 @@ inputMonitor.off("mouse");
## TouchEventReceiver
This class provides the callback of touch events.
### (touchEvent: TouchEvent): Boolean
Provides the callback of touch events.
Represents the callback used to return the touch event. You need to define the name of the callback function in the correct format. Ensure that the input parameter is of the **TouchEvent** type, and the return value is of the **Boolean** type.
This is a system API.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
......
# Keycode
Provides keycodes for a key device.
The Keycode module provides keycodes for a key device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -11,6 +11,8 @@ Provides keycodes for a key device.
import {KeyCode} from '@ohos.multimodalInput.keyCode'
```
## KeyCode
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
......
# Key Event
Represents key events reported by an input device.
The Key Event module provides key events reported by an input device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部