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 ed3029bd8c372c20afb25ad9f465c8cbac729c88..2456f4a08fa9fe5e3346d8ad58a7d2c45c5b3f01 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+ 输入设备热插拔的描述信息。