提交 e49a41c8 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 2b817254
# 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.
先完成此消息的编辑!
想要评论请 注册