未验证 提交 573ca98c 编写于 作者: O openharmony_ci 提交者: Gitee

!2962 2413 处理完成:js-apis-inputmonitor.md 更新

Merge pull request !2962 from ester.zhou/TR-2413
......@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
>
>
> - The APIs of this module are system APIs and cannot be called by third-party applications.
......@@ -31,30 +31,32 @@ Starts listening for global input events.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters**
| Parameter | 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. |
| 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) {
if (checkEvent(value)) {
export default {
callback: function (value) {
if (checkEvent(value)) {
// The event meets the service requirement and is consumed.
return true;
} else {
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
return false;
}
},
testOn: function () {
console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOn");
}
},
testOn: function () {
console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOn");
}
```
......@@ -70,31 +72,33 @@ Stops listening for global input events.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters**
| Parameter | 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. |
| 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) {
if (checkEvent(value)) {
export default {
callback: function (value) {
if (checkEvent(value)) {
// The event meets the service requirement and is consumed.
return true;
} else {
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
}
```
......@@ -105,38 +109,40 @@ 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 used to return the touch 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 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. |
| 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.
if (checkEvent(value)) {
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;
} else {
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
},
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.
先完成此消息的编辑!
想要评论请 注册