提交 5d85eae4 编写于 作者: M mayunteng_1

multimodalinput docs modify

Signed-off-by: Nmayunteng_1 <mayunteng@huawei.com>
Change-Id: I6f8f0dad486e7a8476d72ea113430d9ea0dfeeb4
上级 2153d967
......@@ -16,8 +16,8 @@ import inputDevice from '@ohos.multimodalInput.inputDevice';
| 实例名 | 接口名 | 说明 |
| ----------- | ------------------------------------------------------------ | -------------------------- |
| inputDevice | function getDeviceList(callback: AsyncCallback\<Array\<number>>): void; | 获取输入设备列表。 |
| inputDevice | function getKeyboardType(deviceId: number, callback: AsyncCallback\<KeyboardType>): void; | 获取输入设备的键盘类型。 |
| inputDevice | function getDeviceList(): Promise\<Array\<number>>; | 获取输入设备列表。 |
| inputDevice | function getKeyboardType(deviceId: number): Promise\<KeyboardType>; | 获取输入设备的键盘类型。 |
| inputDevice | function on(type: "change", listener: Callback\<DeviceListener>): void; | 监听输入设备的热插拔事件。 |
| inputDevice | function off(type: "change", listener?: Callback\<DeviceListener>): void; | 取消监听输入设备的热插拔事件。 |
......@@ -51,7 +51,7 @@ try {
// 2.监听设备热插拔
inputDevice.on("change", (data) => {
console.log(`Device event info: ${JSON.stringify(data)}`);
inputDevice.getKeyboardType(data.deviceId, (error, type) => {
inputDevice.getKeyboardType(data.deviceId).then((type) => {
console.log("The keyboard type is: " + type);
if (type === inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') {
// 物理键盘已插入
......
......@@ -122,9 +122,13 @@ isPointerVisible(): Promise&lt;boolean&gt;
**示例**
```js
pointer.isPointerVisible().then((visible) => {
console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`);
});
try {
pointer.isPointerVisible().then((visible) => {
console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`);
});
} catch (error) {
console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSpeed<sup>9+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册