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