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

!19244 增加键盘时延键盘速率API接口说明文档

Merge pull request !19244 from wangli/master
......@@ -460,6 +460,132 @@ try {
}
```
## inputDevice.setKeyboardRepeatDelay<sup>10+</sup>
setKeyboardRepeatDelay(delay: number, callback: AsyncCallback&lt;void&gt;): void
设置键盘按键的重复时延,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| delay | number | 是 | 键盘按键重复延迟时间,默认值500ms,调节范围[300ms,1000ms]。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例**
```js
try {
inputDevice.setKeyboardRepeatDelay(350, (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.setKeyboardRepeatDelay<sup>10+</sup>
setKeyboardRepeatDelay(delay: number): Promise&lt;void&gt;
设置键盘按键的重复时延,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| delay | number | 是 | 键盘按键重复延迟时间,默认值500ms,调节范围[300ms,1000ms]。 |
**返回值**
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise对象。 |
**示例**
```js
try {
inputDevice.setKeyboardRepeatDelay(350).then(() => {
console.log(`Set keyboard repeat delay success`);
});
} catch (error) {
console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## inputDevice.setKeyboardRepeatRate<sup>10+</sup>
setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void
设置键盘按键的重复速率,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| rate | number | 是 | 键盘按键重复速率,默认值50ms/次,调节范围[36ms/次,100ms/次]。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例**
```js
try {
inputDevice.setKeyboardRepeatRate(60, (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.setKeyboardRepeatRate<sup>10+</sup>
setKeyboardRepeatRate(rate: number): Promise&lt;void&gt;
设置键盘按键的重复速率,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| rate | number | 是 | 键盘按键重复速率,默认值50ms/次,调节范围[36ms/次,100ms/次]。 |
**返回值**
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise对象。 |
**示例**
```js
try {
inputDevice.setKeyboardRepeatRate(60).then(() => {
console.log(`Set keyboard repeat rate success`);
});
} catch (error) {
console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## DeviceListener<sup>9+</sup>
输入设备热插拔的描述信息。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册