提交 4355535a 编写于 作者: E ester.zhou

update doc

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 9507cd00
...@@ -31,15 +31,16 @@ Starts listening for global input events. ...@@ -31,15 +31,16 @@ Starts listening for global input events.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor **System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters** **Parameters**
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | -------------------- |
| type | string | Yes | Type&nbsp;of&nbsp;the&nbsp;input&nbsp;event.&nbsp;Currently,&nbsp;only&nbsp;**touch**&nbsp;events&nbsp;are&nbsp;supported. | | type | string | Yes | Type of the input event. Currently, only **touch** events are supported.|
| receiver | [TouchEventReceiver](#toucheventreceiver) | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. | | receiver | [TouchEventReceiver](#toucheventreceiver) | Yes | Callback used to return the touch event. |
**Example** **Example**
``` ```
callback: function (value) { export default {
callback: function (value) {
if (checkEvent(value)) { if (checkEvent(value)) {
// The event meets the service requirement and is consumed. // The event meets the service requirement and is consumed.
return true; return true;
...@@ -47,14 +48,15 @@ callback: function (value) { ...@@ -47,14 +48,15 @@ callback: function (value) {
// The event does not meet the service requirement and is not consumed. // The event does not meet the service requirement and is not consumed.
return false; return false;
} }
}, },
testOn: function () { testOn: function () {
console.info("InputMonitorJsTest---start---testOn"); console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on( inputMonitor.on(
"touch", "touch",
this.callback this.callback
); );
console.info("InputMonitorJsTest---end---testOn"); console.info("InputMonitorJsTest---end---testOn");
}
} }
``` ```
...@@ -70,15 +72,16 @@ Stops listening for global input events. ...@@ -70,15 +72,16 @@ Stops listening for global input events.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor **System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters** **Parameters**
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | -------------------- |
| type | string | Yes | Type&nbsp;of&nbsp;the&nbsp;input&nbsp;event.&nbsp;Currently,&nbsp;only&nbsp;**touch**&nbsp;events&nbsp;are&nbsp;supported. | | type | string | Yes | Type of the input event. Currently, only **touch** events are supported.|
| receiver | [TouchEventReceiver](#toucheventreceiver) | No | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. | | receiver | [TouchEventReceiver](#toucheventreceiver) | No | Callback used to return the touch event. |
**Example** **Example**
``` ```
callback: function (value) { export default {
callback: function (value) {
if (checkEvent(value)) { if (checkEvent(value)) {
// The event meets the service requirement and is consumed. // The event meets the service requirement and is consumed.
return true; return true;
...@@ -86,15 +89,16 @@ callback: function (value) { ...@@ -86,15 +89,16 @@ callback: function (value) {
// The event does not meet the service requirement and is not consumed. // The event does not meet the service requirement and is not consumed.
return false; return false;
} }
}, },
testOff: function () { testOff: function () {
console.info("InputMonitorJsTest---start---testOff"); console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off( inputMonitor.off(
"touch", "touch",
this.callback this.callback
); );
console.info("InputMonitorJsTest---end---testOff"); console.info("InputMonitorJsTest---end---testOff");
} }
}
``` ```
...@@ -105,24 +109,25 @@ Represents the class of the callback used to return the touch event. The value * ...@@ -105,24 +109,25 @@ Represents the class of the callback used to return the touch event. The value *
### (touchEvent: TouchEvent): Boolean ### (touchEvent: TouchEvent): Boolean
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. 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.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor **System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters** **Parameters**
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---------- | ---------------------------------------- | ---- | ---------------------------------------- |
| touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. | | touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | Yes | Callback used to return the touch event.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | ------- | -------------------------------------- |
| Boolean | Result&nbsp;indicating&nbsp;whether&nbsp;the&nbsp;touch&nbsp;event&nbsp;has&nbsp;been&nbsp;consumed&nbsp;by&nbsp;the&nbsp;input&nbsp;monitor.&nbsp;The&nbsp;value&nbsp;**true**&nbsp;indicates&nbsp;that&nbsp;the&nbsp;touch&nbsp;event&nbsp;has&nbsp;been&nbsp;consumed,&nbsp;and&nbsp;the&nbsp;value&nbsp;**false**&nbsp;indicates&nbsp;the&nbsp;opposite. | | Boolean | Result indicating whether the touch event has been consumed by the input monitor. The value **true** indicates that the touch event has been consumed, and the value **false** indicates the opposite.|
**Example** **Example**
``` ```
callback: function (value) {// Implementation of the (touchEvent:TouchEvent): Boolean API. export default {
callback: function (value) { // Implementation of the (touchEvent:TouchEvent): Boolean API.
if (checkEvent(value)) { if (checkEvent(value)) {
// The event meets the service requirement and is consumed. // The event meets the service requirement and is consumed.
return true; return true;
...@@ -130,13 +135,14 @@ callback: function (value) {// Implementation of the (touchEvent:TouchEvent): Bo ...@@ -130,13 +135,14 @@ callback: function (value) {// Implementation of the (touchEvent:TouchEvent): Bo
// The event does not meet the service requirement and is not consumed. // The event does not meet the service requirement and is not consumed.
return false; return false;
} }
}, },
testOff: function () { testOff: function () {
console.info("InputMonitorJsTest---start---testOff"); console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off( inputMonitor.off(
"touch", "touch",
this.callback this.callback
); );
console.info("InputMonitorJsTest---end---testOff"); console.info("InputMonitorJsTest---end---testOff");
}
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册