提交 f504f2b2 编写于 作者: M ma-shaoyin

Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

 Changes to be committed:
上级 340b53e9
......@@ -146,7 +146,7 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```js
inputMethodController.stopInput((err, result) => {
InputMethodController.stopInput((err, result) => {
if (err == undefined) {
console.error("stopInput callback result---err: " + err.msg);
return;
......@@ -177,15 +177,17 @@ stopInput(): Promise&lt;boolean&gt;
```js
await inputMethodController.stopInput().then((result)=>{
if (result) {
console.info("Success to stopInput.(promise)");
} else {
console.info("Failed to stopInput.(promise)");
}
}).catch((err) => {
console.error("stopInput promise err: " + err.msg);
});
async function InputMethod() {
await InputMethodController.stopInput().then((result)=>{
if (result) {
console.info("Success to stopInput.(promise)");
} else {
console.info("Failed to stopInput.(promise)");
}
}).catch((err) => {
console.error("stopInput promise err: " + err.msg);
});
}
```
### showSoftKeyboard<sup>9+</sup> ###
......@@ -310,7 +312,7 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;)
**示例:**
```js
inputMethodSetting.listInputMethod((err,data) => {
InputMethodSetting.listInputMethod((err,data) => {
if (err == undefined) {
console.error("listInputMethod callback result---err: " + err.msg);
return;
......@@ -335,11 +337,13 @@ listInputMethod(): Promise<Array<InputMethodProperty>>;
**示例:**
```js
await inputMethodSetting.listInputMethod().then((data)=>{
console.info("listInputMethod promise result---data: " + JSON.stringify(data));
}).catch((err) => {
console.info("listInputMethod promise err:" + err.msg);
});
async function InputMethod() {
await InputMethodSetting.listInputMethod().then((data)=>{
console.info("listInputMethod promise result---data: " + JSON.stringify(data));
}).catch((err) => {
console.info("listInputMethod promise err:" + err.msg);
});
}
```
### displayOptionalInputMethod
......@@ -359,7 +363,7 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
inputMethodSetting.displayOptionalInputMethod((err) => {
InputMethodSetting.displayOptionalInputMethod((err) => {
if (err == undefined) {
console.error("displayOptionalInputMethod callback---err: " + err.msg);
return;
......@@ -385,9 +389,11 @@ inputMethodSetting.displayOptionalInputMethod((err) => {
**示例:**
```js
await inputMethodSetting.displayOptionalInputMethod().then(()=>{
console.info("displayOptionalInputMethod promise");
}).catch((err) => {
console.info("listInputMethod promise err: " + err.msg);
});
async function InputMethod() {
await InputMethodSetting.displayOptionalInputMethod().then(()=>{
console.info("displayOptionalInputMethod promise");
}).catch((err) => {
console.info("listInputMethod promise err: " + err.msg);
});
}
```
\ No newline at end of file
......@@ -450,11 +450,13 @@ hideKeyboard(): Promise&lt;void&gt;
**示例:**
```js
await KeyboardController.hideKeyboard().then(() => {
console.info("hideKeyboard promise.");
}).catch((err) => {
console.info("hideKeyboard promise err: " + err.msg);
});
async function InputMethodEngine() {
await KeyboardController.hideKeyboard().then(() => {
console.info("hideKeyboard promise.");
}).catch((err) => {
console.info("hideKeyboard promise err: " + err.msg);
});
}
```
## TextInputClient<a name="TextInputClient"></a>
......@@ -512,12 +514,14 @@ getForward(length:number): Promise&lt;string&gt;
**示例:**
```js
var length = 1;
await client.getForward(length).then((text) => {
console.info("getForward promise result---res: " + text);
}).catch((err) => {
console.error("getForward promise err: " + err.msg);
});
async function InputMethodEngine() {
var length = 1;
await TextInputClient.getForward(length).then((text) => {
console.info("getForward promise result---res: " + text);
}).catch((err) => {
console.error("getForward promise err: " + err.msg);
});
}
```
### getBackward
......@@ -571,12 +575,14 @@ getBackward(length:number): Promise&lt;string&gt;
**示例:**
```js
var length = 1;
await TextInputClient.getBackward(length).then((text) => {
console.info("getBackward promise result---res: " + text);
}).catch((err) => {
console.error("getBackward promise err: " + err.msg);
});
async function InputMethodEngine() {
var length = 1;
await TextInputClient.getBackward(length).then((text) => {
console.info("getBackward promise result---res: " + text);
}).catch((err) => {
console.error("getBackward promise err: " + err.msg);
});
}
```
### deleteForward
......@@ -633,16 +639,18 @@ deleteForward(length:number): Promise&lt;boolean&gt;
**示例:**
```js
var length = 1;
await TextInputClient.deleteForward(length).then((result) => {
if (result) {
console.info("Success to deleteForward.(promise) ");
} else {
console.error("Failed to deleteForward.(promise) ");
}
}).catch((err) => {
console.error("deleteForward promise err: " + err.msg);
});
async function InputMethodEngine() {
var length = 1;
await TextInputClient.deleteForward(length).then((result) => {
if (result) {
console.info("Success to deleteForward.(promise) ");
} else {
console.error("Failed to deleteForward.(promise) ");
}
}).catch((err) => {
console.error("deleteForward promise err: " + err.msg);
});
}
```
### deleteBackward
......@@ -699,16 +707,18 @@ deleteBackward(length:number): Promise&lt;boolean&gt;
**示例:**
```js
var length = 1;
await TextInputClient.deleteBackward(length).then((result) => {
if (result) {
console.info("Success to deleteBackward.(promise) ");
} else {
console.error("Failed to deleteBackward.(promise) ");
}
}).catch((err) => {
console.error("deleteBackward promise err: " + err.msg);
});
async function InputMethodEngine() {
var length = 1;
await TextInputClient.deleteBackward(length).then((result) => {
if (result) {
console.info("Success to deleteBackward.(promise) ");
} else {
console.error("Failed to deleteBackward.(promise) ");
}
}).catch((err) => {
console.error("deleteBackward promise err: " + err.msg);
});
}
```
### sendKeyFunction
......@@ -764,15 +774,17 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt;
**示例:**
```js
await client.sendKeyFunction(keyFunction).then((result) => {
if (result) {
console.info("Success to sendKeyFunction.(promise) ");
} else {
console.error("Failed to sendKeyFunction.(promise) ");
}
}).catch((err) => {
console.error("sendKeyFunction promise err:" + err.msg);
});
async function InputMethodEngine() {
await client.sendKeyFunction(keyFunction).then((result) => {
if (result) {
console.info("Success to sendKeyFunction.(promise) ");
} else {
console.error("Failed to sendKeyFunction.(promise) ");
}
}).catch((err) => {
console.error("sendKeyFunction promise err:" + err.msg);
});
}
```
### insertText
......@@ -829,15 +841,17 @@ insertText(text:string): Promise&lt;boolean&gt;
**示例:**
```js
await TextInputClient.insertText('test').then((result) => {
if (result) {
console.info("Success to insertText.(promise) ");
} else {
console.error("Failed to insertText.(promise) ");
}
}).catch((err) => {
console.error("insertText promise err: " + err.msg);
});
async function InputMethodEngine() {
await TextInputClient.insertText('test').then((result) => {
if (result) {
console.info("Success to insertText.(promise) ");
} else {
console.error("Failed to insertText.(promise) ");
}
}).catch((err) => {
console.error("insertText promise err: " + err.msg);
});
}
```
### getEditorAttribute
......@@ -884,12 +898,14 @@ getEditorAttribute(): Promise<EditorAttribute>
**示例:**
```js
await TextInputClient.getEditorAttribute().then((editorAttribute) => {
console.info("editorAttribute.inputPattern(promise): " + JSON.stringify(editorAttribute.inputPattern));
console.info("editorAttribute.enterKeyType(promise): " + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => {
console.error("getEditorAttribute promise err: " + err.msg);
});
async function InputMethodEngine() {
await TextInputClient.getEditorAttribute().then((editorAttribute) => {
console.info("editorAttribute.inputPattern(promise): " + JSON.stringify(editorAttribute.inputPattern));
console.info("editorAttribute.enterKeyType(promise): " + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => {
console.error("getEditorAttribute promise err: " + err.msg);
});
}
```
## EditorAttribute<a name="EditorAttribute"></a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册