diff --git a/zh-cn/application-dev/device/input/inputconsumer-guidelines.md b/zh-cn/application-dev/device/input/inputconsumer-guidelines.md index a7bbd3cc10a12b0899d1ac0676db4c60e9134e98..3ffe8c9a791b941730c8319cab2cdb0235e7beca 100644 --- a/zh-cn/application-dev/device/input/inputconsumer-guidelines.md +++ b/zh-cn/application-dev/device/input/inputconsumer-guidelines.md @@ -31,6 +31,8 @@ import { inputConsumer } from '@kit.InputKit'; 特定全局快捷键的应用开启时调用[on](../../reference/apis-input-kit/js-apis-inputconsumer-sys.md#inputconsumeron)方法订阅全局快捷键,应用关闭时再用[off](../../reference/apis-input-kit/js-apis-inputconsumer-sys.md#inputconsumeroff)方法取消订阅全局快捷键。 ```js +import { inputConsumer } from '@kit.InputKit'; + let leftAltKey = 2045; let tabKey = 2049; let callback = (keyOptions: inputConsumer.KeyOptions) => { @@ -41,14 +43,14 @@ let keyOption: inputConsumer.KeyOptions = {preKeys: [leftAltKey], finalKey: tabK try { inputConsumer.on("key", keyOption, callback);//订阅系统快捷键 } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } //应用关闭 try { inputConsumer.off("key", keyOption, callback);//取消订阅系统快捷键 console.log(`Unsubscribe success`); } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } let leftCtrlKey = 2072; @@ -65,13 +67,13 @@ inputConsumer.getAllSystemHotkeys().then((data: Array {//设置截屏应用screenshot延迟时间为5秒(500毫秒) if (error) { @@ -33,7 +34,7 @@ try { console.log(`Set key down duration success`); }); } catch (error) { - console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/zh-cn/application-dev/reference/apis-input-kit/js-apis-touchevent.md b/zh-cn/application-dev/reference/apis-input-kit/js-apis-touchevent.md index 04d2547c240fb6cf0489fc93d887c53604e04753..c3dd6adbda4e02e32d4369b84858822877ffa40e 100644 --- a/zh-cn/application-dev/reference/apis-input-kit/js-apis-touchevent.md +++ b/zh-cn/application-dev/reference/apis-input-kit/js-apis-touchevent.md @@ -1,6 +1,6 @@ # @ohos.multimodalInput.touchEvent (触摸输入事件) -设备上报的触摸(触屏)事件,继承自[InputEvent](./js-apis-inputevent.md)。 +设备上报的触摸事件,继承自[InputEvent](./js-apis-inputevent.md)。 > **说明:** > @@ -83,13 +83,13 @@ import { Action,ToolType,SourceType,Touch,TouchEvent } from '@kit.InputKit'; ## TouchEvent -触屏事件。 +触摸事件。 **系统能力:** SystemCapability.MultimodalInput.Input.Core | 名称 | 类型 | 只读 | 可选 | 说明 | | ---------- | ---------- | ---- | ---- | --------- | -| action | [Action](#action) | 否 | 否 | 触屏事件类型。 | +| action | [Action](#action) | 否 | 否 | 触摸事件类型。 | | touch | [Touch](#touch) | 否 | 否 | 当前触摸点信息。 | | touches | [Touch](#touch)[] | 否 | 否 | 所有触摸点。 | | sourceType | [SourceType](#sourcetype) | 否 | 否 | 触摸来源的设备类型。 |