From 435eed777d1462acbb86b7b88e8c24eae853f73d Mon Sep 17 00:00:00 2001 From: wangli Date: Mon, 3 Jul 2023 12:45:39 +0800 Subject: [PATCH] add getKeyboardRepeatDelay getKeyboardRepeatRate docs Signed-off-by: wangli --- .../reference/apis/js-apis-inputdevice.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md index 41bd20bd45..bd77e02ada 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md @@ -523,6 +523,62 @@ try { } ``` +## inputDevice.getKeyboardRepeatDelay10+ + +getKeyboardRepeatDelay(callback: AsyncCallback<number>): void + +获取键盘按键的重复时延,使用AsyncCallback异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback<number> | 是 | 回调函数,异步返回键盘按键重复延迟时间。 | + +**示例**: + +```js +try { + inputDevice.getKeyboardRepeatDelay((error, delay) => { + if (error) { + console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get keyboard repeat delay success`); + }); +} catch (error) { + console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + +## inputDevice.getKeyboardRepeatDelay10+ + +getKeyboardRepeatDelay(): Promise<number> + +获取键盘按键的重复时延,使用Promise异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**返回值**: + +| 参数 | 说明 | +| --------------------- | ------------------- | +| Promise<number> | Promise实例,异步返回键盘按键的重复时延。 | + +**示例**: + +```js +try { + inputDevice.getKeyboardRepeatDelay().then(delay => { + console.log(`Get keyboard repeat delay success`); + }); +} catch (error) { + console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + ## inputDevice.setKeyboardRepeatRate10+ setKeyboardRepeatRate(rate: number, callback: AsyncCallback<void>): void @@ -586,6 +642,62 @@ try { } ``` +## inputDevice.getKeyboardRepeatRate10+ + +getKeyboardRepeatRate(callback: AsyncCallback<number>): void + +获取键盘按键的重复速率,使用AsyncCallback异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | -------------- | +| callback | AsyncCallback<number> | 是 | 回调函数,异步返回键盘按键的重复速率。 | + +**示例**: + +```js +try { + inputDevice.getKeyboardRepeatRate((error, rate) => { + if (error) { + console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get keyboard repeat rate success`); + }); +} catch (error) { + console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + +## inputDevice.getKeyboardRepeatRate10+ + +getKeyboardRepeatRate(): Promise<number> + +获取键盘按键的重复速率,使用Promise异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**返回值**: + +| 参数 | 说明 | +| --------------------- | ------------------- | +| Promise<number> | Promise实例,异步返回键盘按键的重复速率。 | + +**示例**: + +```js +try { + inputDevice.getKeyboardRepeatRate().then(rate => { + console.log(`Get keyboard repeat rate success`); + }); +} catch (error) { + console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + ## DeviceListener9+ 输入设备热插拔的描述信息。 -- GitLab