提交 9425bc0f 编写于 作者: H Hollokin

输入法框架API资料-错误码异常处理整改相关

Signed-off-by: NHollokin <taoyuxin2@huawei.com>
上级 3dc405cc
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
``` ```
import inputMethod from '@ohos.inputmethod'; import inputMethod from '@ohos.inputmethod';
import InputMethodSubtype from './@ohos.inputMethodSubtype';
``` ```
## inputMethod<sup>8+</sup> ## inputMethod<sup>8+</sup>
...@@ -48,7 +49,7 @@ getInputMethodController(): InputMethodController ...@@ -48,7 +49,7 @@ getInputMethodController(): InputMethodController
获取客户端实例[InputMethodController](#inputmethodcontroller) 获取客户端实例[InputMethodController](#inputmethodcontroller)
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[getController](#getController)替代 > 从API version 9开始废弃, 建议使用[getController](#inputmethodgetcontroller9)替代
> >
> 从 API version 6开始支持。 > 从 API version 6开始支持。
...@@ -147,7 +148,7 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea ...@@ -147,7 +148,7 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|target | [InputmethodProperty](#inputmethodproperty8) | 是 | 传入要切换的目标输入法。 | |target | [InputMethodProperty](#inputmethodproperty8) | 是 | 传入要切换的目标输入法。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法切换是否成功。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法切换是否成功。 |
...@@ -157,7 +158,6 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea ...@@ -157,7 +158,6 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea
try{ try{
inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'}, (err, result) => { inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'}, (err, result) => {
if (err) { if (err) {
// 处理业务逻辑执行错误
console.error('switchInputMethod err: ' + JSON.stringify(err)); console.error('switchInputMethod err: ' + JSON.stringify(err));
return; return;
} }
...@@ -168,7 +168,6 @@ try{ ...@@ -168,7 +168,6 @@ try{
} }
}); });
} catch(err) { } catch(err) {
// 捕获参数错误
console.error('switchInputMethod err: ' + JSON.stringify(err)); console.error('switchInputMethod err: ' + JSON.stringify(err));
} }
``` ```
...@@ -245,7 +244,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb ...@@ -245,7 +244,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|target | [InputMethodSubtype](#InputMethodSubtype)| 是 | 传入要切换的目标输入法子类型。 | |target | [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法子类型切换是否成功。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法子类型切换是否成功。 |
**示例:** **示例:**
...@@ -286,7 +285,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean& ...@@ -286,7 +285,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean&
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|target | [InputMethodSubtype](#InputMethodSubtype)| 是 | 传入要切换的目标输入法子类型。 | |target | [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
**示例:** **示例:**
...@@ -324,7 +323,7 @@ getCurrentInputMethodSubtype(): InputMethodSubtype ...@@ -324,7 +323,7 @@ getCurrentInputMethodSubtype(): InputMethodSubtype
| 类型 | 说明 | | 类型 | 说明 |
| -------------------------------------------- | ------------------------ | | -------------------------------------------- | ------------------------ |
| [InputMethodSubtype](#InputMethodSubtype) | 返回当前输入法子类型对象。 | | [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype) | 返回当前输入法子类型对象。 |
**示例:** **示例:**
...@@ -346,8 +345,8 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp ...@@ -346,8 +345,8 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#InputMethodProperty)| 是 | 传入要切换的目标输入法。 | |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
|inputMethodSubtype | [inputMethodSubtype](#InputMethodSubtype)| 是 | 传入要切换的目标输入法子类型。 | |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法和子类型切换是否成功。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法和子类型切换是否成功。 |
**示例:** **示例:**
...@@ -392,8 +391,8 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp ...@@ -392,8 +391,8 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#InputMethodProperty)| 是 | 传入要切换的目标输入法。 | |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
|inputMethodSubtype | [inputMethodSubtype](#InputMethodSubtype)| 是 | 传入要切换的目标输入法子类型。 | |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
**示例:** **示例:**
...@@ -423,7 +422,7 @@ try { ...@@ -423,7 +422,7 @@ try {
## InputMethodController ## InputMethodController
下列API示例中都需使用[getController](#inputmethodgetcontroller)回调获取到InputMethodController实例,再通过此实例调用对应方法。 下列API示例中都需使用[getController](##inputmethodgetcontroller9)回调获取到InputMethodController实例,再通过此实例调用对应方法。
### stopInput<sup>(deprecated)</sup> ### stopInput<sup>(deprecated)</sup>
...@@ -432,7 +431,7 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -432,7 +431,7 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void
隐藏输入法。使用callback形式返回结果。参数个数为1,否则抛出异常。 隐藏输入法。使用callback形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[stopInputSession](#stopInputSession)替代 > 从API version 9开始废弃, 建议使用[stopInputSession](#stopinputsession9)替代
> >
> 从 API version 6开始支持。 > 从 API version 6开始支持。
...@@ -467,7 +466,7 @@ stopInput(): Promise&lt;boolean&gt; ...@@ -467,7 +466,7 @@ stopInput(): Promise&lt;boolean&gt;
隐藏输入法。使用promise形式返回结果。参数个数为0,否则抛出异常。 隐藏输入法。使用promise形式返回结果。参数个数为0,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[stopInputSession](#stopInputSession)替代 > 从API version 9开始废弃, 建议使用[stopInputSession](#stopinputsession9)替代
> >
> 从 API version 6开始支持。 > 从 API version 6开始支持。
...@@ -559,7 +558,7 @@ try { ...@@ -559,7 +558,7 @@ try {
} }
``` ```
### showSoftKeyboard<sup>9+</sup> ### ### showSoftKeyboard<sup>9+</sup>
showSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void showSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
...@@ -585,7 +584,7 @@ InputMethodController.showSoftKeyboard((err) => { ...@@ -585,7 +584,7 @@ InputMethodController.showSoftKeyboard((err) => {
}) })
``` ```
### showSoftKeyboard<sup>9+</sup> ### ### showSoftKeyboard<sup>9+</sup>
showSoftKeyboard(): Promise&lt;void&gt; showSoftKeyboard(): Promise&lt;void&gt;
...@@ -609,7 +608,7 @@ InputMethodController.showSoftKeyboard().then(async (err) => { ...@@ -609,7 +608,7 @@ InputMethodController.showSoftKeyboard().then(async (err) => {
}); });
``` ```
### hideSoftKeyboard<sup>9+</sup> ### ### hideSoftKeyboard<sup>9+</sup>
hideSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void hideSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
...@@ -676,7 +675,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input ...@@ -676,7 +675,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 | | type | string | 是 | 设置监听类型。<br/>-type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 |
| callback | [inputMethodProperty](#InputMethodProperty), [inputMethodSubtype](#InputMethodSubtype) | 是 | 回调返回输入法及子类型相关实例。 | | callback | [InputMethodProperty](#inputmethodproperty8), [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype) | 是 | 回调返回输入法及子类型相关实例。 |
**示例:** **示例:**
...@@ -700,7 +699,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input ...@@ -700,7 +699,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 | | type | string | 是 | 设置监听类型。<br/>-type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 |
| callback | [inputMethodProperty](#InputMethodProperty), [inputMethodSubtype](#InputMethodSubtype) | 否 | 回调返回输入法及子类型相关实例。 | | callback | [InputMethodProperty](#inputmethodproperty8), [InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype) | 否 | 回调返回输入法及子类型相关实例。 |
**示例:** **示例:**
...@@ -721,7 +720,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async ...@@ -721,7 +720,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| inputMethodProperty | InputMethodProperty| 是 | 指定获取子类型所属的输入法应用 | inputMethodProperty | InputMethodProperty| 是 | 指定获取子类型所属的输入法应用
| callback | Array<[InputMethodSubtype](#InputMethodSubtype)> | 是 | 返回已安装输入法列表。 | | callback | Array<[InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)> | 是 | 返回已安装输入法列表。 |
**示例:** **示例:**
...@@ -761,7 +760,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise&lt;Arr ...@@ -761,7 +760,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise&lt;Arr
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](#InputMethodSubtype)>> | 返回已安装输入法子类型列表。 | | Promise<Array<[InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)>> | 返回已安装输入法子类型列表。 |
**示例:** **示例:**
...@@ -793,7 +792,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback&lt;Array&lt;InputMethodSub ...@@ -793,7 +792,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback&lt;Array&lt;InputMethodSub
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | Array<[InputMethodSubtype](#InputMethodSubtype)> | 是 | 返回当前输入法的子类型列表。 | | callback | Array<[InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)> | 是 | 返回当前输入法的子类型列表。 |
**示例:** **示例:**
...@@ -823,7 +822,7 @@ listCurrentInputMethodSubtype(): Promise&lt;Array&lt;InputMethodSubtype&gt;&gt; ...@@ -823,7 +822,7 @@ listCurrentInputMethodSubtype(): Promise&lt;Array&lt;InputMethodSubtype&gt;&gt;
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](#InputMethodSubtype)>> | 返回当前输入法的子类型列表。 | | Promise<Array<[InputMethodSubtype](./js-apis-inputmethodsubtype.md#inputmethodsubtype)>> | 返回当前输入法的子类型列表。 |
**示例:** **示例:**
......
...@@ -58,7 +58,7 @@ getInputMethodEngine(): InputMethodEngine ...@@ -58,7 +58,7 @@ getInputMethodEngine(): InputMethodEngine
获取服务端实例。 获取服务端实例。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[getInputMethodAbility](#getInputMethodAbility)替代 > 从API version 9开始废弃, 建议使用[getInputMethodAbility](#inputmethodenginegetinputmethodability9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -88,7 +88,7 @@ getInputMethodAbility(): InputMethodAbility ...@@ -88,7 +88,7 @@ getInputMethodAbility(): InputMethodAbility
| 类型 | 说明 | | 类型 | 说明 |
| --------------------------------------- | ------------ | | --------------------------------------- | ------------ |
| [InputMethodAbility](#InputMethodAbility) | 服务端实例。 | | [InputMethodAbility](#inputmethodability) | 服务端实例。 |
**示例:** **示例:**
...@@ -121,7 +121,7 @@ createKeyboardDelegate(): KeyboardDelegate ...@@ -121,7 +121,7 @@ createKeyboardDelegate(): KeyboardDelegate
var KeyboardDelegate = inputMethodEngine.createKeyboardDelegate(); var KeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
``` ```
## inputMethodEngine.getKeyboardDelegate<a name="getKeyboardDelegate"></a> ## inputMethodEngine.getKeyboardDelegate<a name="getKeyboardDelegate"></a><sup>9+</sup>
getKeyboardDelegate(): KeyboardDelegate getKeyboardDelegate(): KeyboardDelegate
...@@ -143,7 +143,7 @@ getKeyboardDelegate(): KeyboardDelegate ...@@ -143,7 +143,7 @@ getKeyboardDelegate(): KeyboardDelegate
## InputMethodEngine<a name="InputMethodEngine"></a> ## InputMethodEngine<a name="InputMethodEngine"></a>
下列API示例中都需使用[getInputMethodEngine](#getInputMethodEngine)回调获取到InputMethodEngine实例,再通过此实例调用对应方法。 下列API示例中都需使用[getInputMethodEngine](#inputmethodenginegetinputmethodenginedeprecated)回调获取到InputMethodEngine实例,再通过此实例调用对应方法。
### on('inputStart')<a name="inputStart"></a> ### on('inputStart')<a name="inputStart"></a>
...@@ -158,7 +158,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli ...@@ -158,7 +158,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 | | type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#KeyboardController), [TextInputClient](#TextInputClient) | 是 | 回调返回输入法操作相关实例。 | | callback | [KeyboardController](#keyboardcontroller), [TextInputClient](#textinputclient) | 是 | 回调返回输入法操作相关实例。 |
**示例:** **示例:**
...@@ -182,7 +182,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC ...@@ -182,7 +182,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ | | -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 | | type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#KeyboardController), [TextInputClient](#TextInputClient) | 否 | 回调返回输入法操作相关实例。 | | callback | [KeyboardController](#keyboardcontroller), [TextInputClient](#textinputclient) | 否 | 回调返回输入法操作相关实例。 |
...@@ -340,7 +340,7 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void ...@@ -340,7 +340,7 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
## InputMethodAbility<a name="InputMethodAbility"></a> ## InputMethodAbility<a name="InputMethodAbility"></a>
下列API示例中都需使用[getInputMethodAbility](#getInputMethodAbility)回调获取到InputMethodAbility实例,再通过此实例调用对应方法。 下列API示例中都需使用[getInputMethodAbility](#inputmethodenginegetinputmethodability9)回调获取到InputMethodAbility实例,再通过此实例调用对应方法。
### on('inputStart')<a name="inputStart"></a><sup>9+</sup> ### on('inputStart')<a name="inputStart"></a><sup>9+</sup>
...@@ -355,7 +355,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: ...@@ -355,7 +355,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 | | type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#KeyboardController), [InputClient](#InputClient) | 是 | 回调返回输入法操作相关实例。 | | callback | [KeyboardController](#keyboardcontroller), [InputClient](#inputclient-9) | 是 | 回调返回输入法操作相关实例。 |
**示例:** **示例:**
...@@ -379,7 +379,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClien ...@@ -379,7 +379,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClien
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ | | -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 | | type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#KeyboardController), [InputClient](#InputClient) | 否 | 回调返回输入法操作相关实例。 | | callback | [KeyboardController](#keyboardcontroller), [InputClient](#inputclient) | 否 | 回调返回输入法操作相关实例。 |
**示例:** **示例:**
...@@ -596,7 +596,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void ...@@ -596,7 +596,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 | | type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 |
| callback | [KeyEvent](#KeyEvent) | 是 | 回调返回按键信息。 | | callback | [KeyEvent](#keyevent) | 是 | 回调返回按键信息。 |
**示例:** **示例:**
...@@ -626,7 +626,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void ...@@ -626,7 +626,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 | | type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 |
| callback | [KeyEvent](#KeyEvent) | 否 | 回调返回按键信息。 | | callback | [KeyEvent](#keyevent) | 否 | 回调返回按键信息。 |
**示例:** **示例:**
...@@ -789,7 +789,7 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => { ...@@ -789,7 +789,7 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => {
## KeyboardController<a name="KeyboardController"></a> ## KeyboardController<a name="KeyboardController"></a>
下列API示例中都需使用[inputStart](#inputStart)回调获取到KeyboardController实例,再通过此实例调用对应方法。 下列API示例中都需使用[inputStart](#oninputstart9)回调获取到KeyboardController实例,再通过此实例调用对应方法。
### hideKeyboard ### hideKeyboard
...@@ -845,7 +845,7 @@ async function InputMethodEngine() { ...@@ -845,7 +845,7 @@ async function InputMethodEngine() {
## TextInputClient<a name="TextInputClient"></a> ## TextInputClient<a name="TextInputClient"></a>
下列API示例中都需使用[inputStart](#inputStart)回调获取到TextInputClient实例,再通过此实例调用对应方法。 下列API示例中都需使用[inputStart](#oninputstart)回调获取到TextInputClient实例,再通过此实例调用对应方法。
### getForward<sup>(deprecated)</sup> ### getForward<sup>(deprecated)</sup>
...@@ -854,7 +854,7 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void ...@@ -854,7 +854,7 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void
获取光标前固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 获取光标前固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getForward](#InputClient.getForward)替代 > 从API version 9开始废弃, 建议使用[getForward](#getforward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -887,7 +887,7 @@ getForward(length:number): Promise&lt;string&gt; ...@@ -887,7 +887,7 @@ getForward(length:number): Promise&lt;string&gt;
获取光标前固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。 获取光标前固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getForward](#InputClient.getForward)替代 > 从API version 9开始废弃, 建议使用[getForward](#getforward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -925,7 +925,7 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void ...@@ -925,7 +925,7 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void
获取光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 获取光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getBackward](#InputClient.getBackward)替代 > 从API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -958,7 +958,7 @@ getBackward(length:number): Promise&lt;string&gt; ...@@ -958,7 +958,7 @@ getBackward(length:number): Promise&lt;string&gt;
获取光标后固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。 获取光标后固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getBackward](#InputClient.getBackward)替代 > 从API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -996,7 +996,7 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -996,7 +996,7 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
删除光标前固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 删除光标前固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.deleteForward](#InputClient.deleteForward)替代 > 从API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1032,7 +1032,7 @@ deleteForward(length:number): Promise&lt;boolean&gt; ...@@ -1032,7 +1032,7 @@ deleteForward(length:number): Promise&lt;boolean&gt;
删除光标前固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。 删除光标前固定长度的文本。使用promise形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.deleteForward](#InputClient.deleteForward)替代 > 从API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1074,7 +1074,7 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -1074,7 +1074,7 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
删除光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 删除光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.deleteBackward](#InputClient.deleteBackward)替代 > 从API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1111,7 +1111,7 @@ deleteBackward(length:number): Promise&lt;boolean&gt; ...@@ -1111,7 +1111,7 @@ deleteBackward(length:number): Promise&lt;boolean&gt;
删除光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 删除光标后固定长度的文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.deleteBackward](#InputClient.deleteBackward)替代 > 从API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1152,7 +1152,7 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -1152,7 +1152,7 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void
发送功能键。使用callback形式返回结果。参数个数为2,否则抛出异常。 发送功能键。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.sendKeyFunction](#InputClient.sendKeyFunction)替代 > 从API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1188,7 +1188,7 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt; ...@@ -1188,7 +1188,7 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt;
发送功能键。使用promise形式返回结果。参数个数为1,否则抛出异常。 发送功能键。使用promise形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.sendKeyFunction](#InputClient.sendKeyFunction)替代 > 从API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1229,7 +1229,7 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -1229,7 +1229,7 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void
插入文本。使用callback形式返回结果。参数个数为2,否则抛出异常。 插入文本。使用callback形式返回结果。参数个数为2,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.insertText](#InputClient.insertText)替代 > 从API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1265,7 +1265,7 @@ insertText(text:string): Promise&lt;boolean&gt; ...@@ -1265,7 +1265,7 @@ insertText(text:string): Promise&lt;boolean&gt;
插入文本。使用promise形式返回结果。参数个数为1,否则抛出异常。 插入文本。使用promise形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.insertText](#InputClient.insertText)替代 > 从API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1306,7 +1306,7 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void ...@@ -1306,7 +1306,7 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void
获取编辑框属性值。使用callback形式返回结果。参数个数为1,否则抛出异常。 获取编辑框属性值。使用callback形式返回结果。参数个数为1,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getEditorAttribute](#InputClient.getEditorAttribute)替代 > 从API version 9开始废弃, 建议使用[getEditorAttribute](#getrditorattribute9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1316,7 +1316,7 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void ...@@ -1316,7 +1316,7 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;[EditorAttribute](#EditorAttribute)&gt; | 是 | 编辑框属性值。 | | callback | AsyncCallback&lt;[EditorAttribute](#editorattribute)&gt; | 是 | 编辑框属性值。 |
**示例:** **示例:**
...@@ -1338,7 +1338,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt; ...@@ -1338,7 +1338,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
获取编辑框属性值。使用promise形式返回结果。参数个数为0,否则抛出异常。 获取编辑框属性值。使用promise形式返回结果。参数个数为0,否则抛出异常。
> **说明:** > **说明:**
> 从API version 9开始废弃, 建议使用[InputClient.getEditorAttribute](#InputClient.getEditorAttribute)替代 > 从API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代
> >
> 从 API version 8开始支持。 > 从 API version 8开始支持。
...@@ -1348,7 +1348,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt; ...@@ -1348,7 +1348,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | | ------------------------------- | ------------------------------------------------------------ |
| Promise&lt;[EditorAttribute](#EditorAttribute)&gt; | 返回编辑框属性值。 | | Promise&lt;[EditorAttribute](#editorattribute)&gt; | 返回编辑框属性值。 |
**示例:** **示例:**
...@@ -1363,9 +1363,9 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt; ...@@ -1363,9 +1363,9 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
} }
``` ```
## InputClient <a name="InputClient "></a><sup>9+</sup> ## InputClient<a name="InputClient "></a><sup>9+</sup>
下列API示例中都需使用[inputStart](#inputStart)回调获取到InputClient实例,再通过此实例调用对应方法。 下列API示例中都需使用[inputStart](#inputStart9)回调获取到InputClient实例,再通过此实例调用对应方法。
### sendKeyFunction<sup>9+</sup> ### sendKeyFunction<sup>9+</sup>
...@@ -1838,7 +1838,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt; ...@@ -1838,7 +1838,7 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | | ------------------------------- | ------------------------------------------------------------ |
| Promise&lt;[EditorAttribute](#EditorAttribute)&gt; | 返回编辑框属性值。 | | Promise&lt;[EditorAttribute](#editorattribute)&gt; | 返回编辑框属性值。 |
**示例:** **示例:**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册