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

!20379 键盘获取重复时延重复速率文档

Merge pull request !20379 from wangli/master
...@@ -468,6 +468,8 @@ setKeyboardRepeatDelay(delay: number, callback: AsyncCallback<void>): void ...@@ -468,6 +468,8 @@ setKeyboardRepeatDelay(delay: number, callback: AsyncCallback<void>): void
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -499,6 +501,8 @@ setKeyboardRepeatDelay(delay: number): Promise<void> ...@@ -499,6 +501,8 @@ setKeyboardRepeatDelay(delay: number): Promise<void>
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -523,6 +527,66 @@ try { ...@@ -523,6 +527,66 @@ try {
} }
``` ```
## inputDevice.getKeyboardRepeatDelay<sup>10+</sup>
getKeyboardRepeatDelay(callback: AsyncCallback&lt;number&gt;): void
获取键盘按键的重复时延,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数,异步返回键盘按键重复延迟时间。 |
**示例**
```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.getKeyboardRepeatDelay<sup>10+</sup>
getKeyboardRepeatDelay(): Promise&lt;number&gt;
获取键盘按键的重复时延,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**返回值**
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise&lt;number&gt; | 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.setKeyboardRepeatRate<sup>10+</sup> ## inputDevice.setKeyboardRepeatRate<sup>10+</sup>
setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void
...@@ -531,6 +595,8 @@ setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -531,6 +595,8 @@ setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -562,6 +628,8 @@ setKeyboardRepeatRate(rate: number): Promise&lt;void&gt; ...@@ -562,6 +628,8 @@ setKeyboardRepeatRate(rate: number): Promise&lt;void&gt;
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -586,6 +654,66 @@ try { ...@@ -586,6 +654,66 @@ try {
} }
``` ```
## inputDevice.getKeyboardRepeatRate<sup>10+</sup>
getKeyboardRepeatRate(callback: AsyncCallback&lt;number&gt;): void
获取键盘按键的重复速率,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数,异步返回键盘按键的重复速率。 |
**示例**
```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.getKeyboardRepeatRate<sup>10+</sup>
getKeyboardRepeatRate(): Promise&lt;number&gt;
获取键盘按键的重复速率,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.InputDevice
**系统API**:此接口为系统接口。
**返回值**
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise&lt;number&gt; | 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`])}`);
}
```
## DeviceListener<sup>9+</sup> ## DeviceListener<sup>9+</sup>
输入设备热插拔的描述信息。 输入设备热插拔的描述信息。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册