From e49a41c803e757541da766261e25d870393a1cb5 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Tue, 5 Jul 2022 15:19:16 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- .../reference/apis/js-apis-inputconsumer.md | 21 ++++++++++------ .../reference/apis/js-apis-inputdevice.md | 10 ++++---- .../reference/apis/js-apis-inputevent.md | 4 ++++ .../apis/js-apis-inputeventclient.md | 13 ++++++---- .../reference/apis/js-apis-inputmonitor.md | 24 ++++++++++++------- .../reference/apis/js-apis-keycode.md | 4 +++- .../reference/apis/js-apis-keyevent.md | 2 +- 7 files changed, 50 insertions(+), 28 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-inputconsumer.md b/en/application-dev/reference/apis/js-apis-inputconsumer.md index 8a45843350..dbb47a0d3a 100644 --- a/en/application-dev/reference/apis/js-apis-inputconsumer.md +++ b/en/application-dev/reference/apis/js-apis-inputconsumer.md @@ -1,5 +1,6 @@ -# Combination Key +# Input Consumer +The Input Consumer module implements listening for key events. > **NOTE**
> @@ -18,19 +19,21 @@ import inputConsumer from '@ohos.multimodalInput.inputConsumer'; ## inputConsumer.on -on(type: "key", keyOptions: KeyOptions, callback: Callback): void +on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): 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.
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<KeyOptions> | Yes| Callback used to return the result.
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): void +off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): 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 | Yes| Callback function passed to the key input event with **keyOptions** when listening starts.| +| callback | Callback<KeyOptions> | 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** diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index c47a977b1f..c1ec2c787a 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -1,7 +1,7 @@ # 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**
@@ -179,7 +179,7 @@ inputDevice.getDevice(1).then((inputDevice)=>{ ## inputDevice.supportKeys9+ -supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void; +supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): 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.supportKeys9+ -supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; +supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>> 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.getKeyboardType9+ -getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; +getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): 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.getKeyboardType9+ -getKeyboardType(deviceId: number,): Promise<KeyboardType>; +getKeyboardType(deviceId: number,): Promise<KeyboardType> Obtains the keyboard type of an input device. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-inputevent.md b/en/application-dev/reference/apis/js-apis-inputevent.md index 5718f96c2c..862c39c608 100644 --- a/en/application-dev/reference/apis/js-apis-inputevent.md +++ b/en/application-dev/reference/apis/js-apis-inputevent.md @@ -1,5 +1,7 @@ # Input Event +The Input Event module describes basic events reported by an input device. + > **NOTE**
> 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** diff --git a/en/application-dev/reference/apis/js-apis-inputeventclient.md b/en/application-dev/reference/apis/js-apis-inputeventclient.md index be8c4ad17b..c38734f143 100644 --- a/en/application-dev/reference/apis/js-apis-inputeventclient.md +++ b/en/application-dev/reference/apis/js-apis-inputeventclient.md @@ -1,11 +1,12 @@ # Key Injection +The Key Injection module implements injection of key events. > **NOTE**
> -> 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.| diff --git a/en/application-dev/reference/apis/js-apis-inputmonitor.md b/en/application-dev/reference/apis/js-apis-inputmonitor.md index 6bbd043fd8..07084623fb 100644 --- a/en/application-dev/reference/apis/js-apis-inputmonitor.md +++ b/en/application-dev/reference/apis/js-apis-inputmonitor.md @@ -1,5 +1,6 @@ # Input Monitor +The Input Monitor module implements listening for global touch events. > **NOTE**
> - 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):void +on(type: "mouse", receiver: Callback<MouseEvent>): 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 | Yes | Callback used to return the mouse event. | +| receiver | Callback<MouseEvent> | 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):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 | No | Callback used to return the mouse event. | +| receiver | Callback<MouseEvent> | 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 diff --git a/en/application-dev/reference/apis/js-apis-keycode.md b/en/application-dev/reference/apis/js-apis-keycode.md index 5bf402c3d7..9a1c171257 100644 --- a/en/application-dev/reference/apis/js-apis-keycode.md +++ b/en/application-dev/reference/apis/js-apis-keycode.md @@ -1,6 +1,6 @@ # Keycode -Provides keycodes for a key device. +The Keycode module provides keycodes for a key device. > **NOTE**
> 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| diff --git a/en/application-dev/reference/apis/js-apis-keyevent.md b/en/application-dev/reference/apis/js-apis-keyevent.md index 085bee426f..ded0aab53e 100644 --- a/en/application-dev/reference/apis/js-apis-keyevent.md +++ b/en/application-dev/reference/apis/js-apis-keyevent.md @@ -1,6 +1,6 @@ # Key Event -Represents key events reported by an input device. +The Key Event module provides key events reported by an input device. > **NOTE**
> 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. -- GitLab