From 8addf6b74c61cd75b9bce7d8e00230478f9f3e69 Mon Sep 17 00:00:00 2001 From: "wangli (A)" Date: Tue, 6 Jun 2023 14:29:33 +0800 Subject: [PATCH] add api doc Signed-off-by: wangli --- .../reference/apis/js-apis-inputdevice.md | 126 ++++++++++++++++++ 1 file changed, 126 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 ed3029bd8c..2456f4a08f 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputdevice.md @@ -460,6 +460,132 @@ try { } ``` +## inputDevice.setKeyboardRepeatDelay10+ + +setKeyboardRepeatDelay(delay: number, callback: AsyncCallback<void>): void + +设置键盘按键的重复时延,使用AsyncCallback异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| delay | number | 是 | 键盘按键重复延迟时间。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例**: + +```js +try { + inputDevice.setKeyboardRepeatDelay(5, (error) => { + if (error) { + console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set keyboard repeat delay success`); + }); +} catch (error) { + console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + +## inputDevice.setKeyboardRepeatDelay10+ + +setKeyboardRepeatDelay(delay: number): Promise<void> + +设置键盘按键的重复时延,使用Promise异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ----------------------------------- | +| delay | number | 是 | 键盘按键重复延迟时间。| + +**返回值**: + +| 参数 | 说明 | +| ------------------- | ---------------- | +| Promise<void> | Promise对象。 | + +**示例**: + +```js +try { + inputDevice.setKeyboardRepeatDelay(5).then(() => { + console.log(`Set keyboard repeat delay success`); + }); +} catch (error) { + console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + +## inputDevice.setKeyboardRepeatRate10+ + +setKeyboardRepeatRate(rate: number, callback: AsyncCallback<void>): void + +设置键盘按键的重复速率,使用AsyncCallback异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| rate | number | 是 | 键盘按键重复速率。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例**: + +```js +try { + inputDevice.setKeyboardRepeatRate(5, (error) => { + if (error) { + console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set keyboard repeat rate success`); + }); +} catch (error) { + console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + +## inputDevice.setKeyboardRepeatRate10+ + +setKeyboardRepeatRate(rate: number): Promise<void> + +设置键盘按键的重复速率,使用Promise异步方式返回结果。 + +**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ----------------------------------- | +| rate | number | 是 | 键盘按键重复速率。| + +**返回值**: + +| 参数 | 说明 | +| ------------------- | ---------------- | +| Promise<void> | Promise对象。 | + +**示例**: + +```js +try { + inputDevice.setKeyboardRepeatRate(5).then(() => { + console.log(`Set keyboard repeat rate success`); + }); +} catch (error) { + console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +} +``` + ## DeviceListener9+ 输入设备热插拔的描述信息。 -- GitLab