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