Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ae36ff33
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ae36ff33
编写于
10月 21, 2022
作者:
H
Hollokin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
输入法框架API资料补充
Signed-off-by:
N
Hollokin
<
taoyuxin2@huawei.com
>
上级
1a1ff423
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
318 addition
and
311 deletion
+318
-311
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
...v/reference/apis/js-apis-inputmethod-extension-ability.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
...v/reference/apis/js-apis-inputmethod-extension-context.md
+22
-12
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+99
-101
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+191
-192
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
浏览文件 @
ae36ff33
...
@@ -40,7 +40,7 @@ Extension生命周期回调,在拉起Extension输入法应用时调用,执
...
@@ -40,7 +40,7 @@ Extension生命周期回调,在拉起Extension输入法应用时调用,执
**示例:**
**示例:**
```
j
s
```
t
s
class
InputMethodExt
extends
InputMethodExtensionAbility
{
class
InputMethodExt
extends
InputMethodExtensionAbility
{
onCreate
(
want
)
{
onCreate
(
want
)
{
console
.
log
(
'
onCreate, want:
'
+
want
.
abilityName
);
console
.
log
(
'
onCreate, want:
'
+
want
.
abilityName
);
...
@@ -61,7 +61,7 @@ Extension生命周期回调,在销毁输入法应用时回调,执行资源
...
@@ -61,7 +61,7 @@ Extension生命周期回调,在销毁输入法应用时回调,执行资源
**示例:**
**示例:**
```
j
s
```
t
s
class
InputMethodExt
extends
InputMethodExtensionAbility
{
class
InputMethodExt
extends
InputMethodExtensionAbility
{
onDestroy
()
{
onDestroy
()
{
console
.
log
(
'
onDestroy
'
);
console
.
log
(
'
onDestroy
'
);
...
@@ -88,7 +88,7 @@ Extension生命周期回调,在一个输入法extention开始时回调,执
...
@@ -88,7 +88,7 @@ Extension生命周期回调,在一个输入法extention开始时回调,执
**示例:**
**示例:**
```
j
s
```
t
s
class
InputMethodExt
extends
InputMethodExtensionAbility
{
class
InputMethodExt
extends
InputMethodExtensionAbility
{
onRequest
(
want
,
startId
)
{
onRequest
(
want
,
startId
)
{
console
.
log
(
'
onRequest, want:
'
+
want
.
abilityName
+
'
startId:
'
+
startId
);
console
.
log
(
'
onRequest, want:
'
+
want
.
abilityName
+
'
startId:
'
+
startId
);
...
@@ -120,7 +120,7 @@ Extension生命周期回调,在输入法extention首次连接输入法ability
...
@@ -120,7 +120,7 @@ Extension生命周期回调,在输入法extention首次连接输入法ability
**示例:**
**示例:**
```
j
s
```
t
s
import
rpc
from
'
@ohos.rpc
'
import
rpc
from
'
@ohos.rpc
'
class
StubTest
extends
rpc
.
RemoteObject
{
class
StubTest
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
constructor
(
des
)
{
...
@@ -155,7 +155,7 @@ Extension生命周期回调,在所有连接在输入法extention上的ability
...
@@ -155,7 +155,7 @@ Extension生命周期回调,在所有连接在输入法extention上的ability
**示例:**
**示例:**
```
j
s
```
t
s
class
InputMethodExt
extends
InputMethodExtensionAbility
{
class
InputMethodExt
extends
InputMethodExtensionAbility
{
onDisconnect
(
want
)
{
onDisconnect
(
want
)
{
console
.
log
(
'
onDisconnect, want:
'
+
want
.
abilityName
);
console
.
log
(
'
onDisconnect, want:
'
+
want
.
abilityName
);
...
@@ -181,7 +181,7 @@ Extension生命周期回调,在一个新的客户端去尝试连接输入法ex
...
@@ -181,7 +181,7 @@ Extension生命周期回调,在一个新的客户端去尝试连接输入法ex
**示例:**
**示例:**
```
j
s
```
t
s
class
InputMethodExt
extends
InputMethodExtensionAbility
{
class
InputMethodExt
extends
InputMethodExtensionAbility
{
onReconnect
(
want
)
{
onReconnect
(
want
)
{
console
.
log
(
'
onReconnect, want:
'
+
want
.
abilityName
);
console
.
log
(
'
onReconnect, want:
'
+
want
.
abilityName
);
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
浏览文件 @
ae36ff33
...
@@ -19,7 +19,7 @@ import InputMethodExtensionContext from '@ohos.inputmethodextensioncontext';
...
@@ -19,7 +19,7 @@ import InputMethodExtensionContext from '@ohos.inputmethodextensioncontext';
在使用InputMethodExtensionContext的功能前,需要通过InputMethodExtensionAbility子类实例获取。
在使用InputMethodExtensionContext的功能前,需要通过InputMethodExtensionAbility子类实例获取。
```
j
s
```
t
s
import
InputMethodExtensionAbility
from
'
@ohos.inputmethodextensionability
'
;
import
InputMethodExtensionAbility
from
'
@ohos.inputmethodextensionability
'
;
class
MainAbility
extends
InputMethodExtensionAbility
{
class
MainAbility
extends
InputMethodExtensionAbility
{
onCreate
()
{
onCreate
()
{
...
@@ -32,7 +32,9 @@ class MainAbility extends InputMethodExtensionAbility {
...
@@ -32,7 +32,9 @@ class MainAbility extends InputMethodExtensionAbility {
startAbility(want: Want, callback: AsyncCallback
<
void
>
): void;
startAbility(want: Want, callback: AsyncCallback
<
void
>
): void;
启动Ability,包含一个Want类型参数。callback形式返回启动结果。
启动Ability。使用callback异步回调。
**模型约束**
: 此接口仅可在Stage模型下使用。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
@@ -41,11 +43,11 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
...
@@ -41,11 +43,11 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-Want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| want |
[
Want
](
js-apis-application-Want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
,返回接口调用是否成功的结果
。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
。当启动Ability成功,err为undefined;否则为错误对象
。 |
**示例:**
**示例:**
```
j
s
```
t
s
let
want
=
{
let
want
=
{
'
bundleName
'
:
'
com.example.myapp
'
,
'
bundleName
'
:
'
com.example.myapp
'
,
'
abilityName
'
:
'
MyAbility
'
'
abilityName
'
:
'
MyAbility
'
...
@@ -61,6 +63,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
...
@@ -61,6 +63,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
启动Ability,包含Want类型参数,以及可选填的StartOption类型参数。通过Promise方法返回结果。
启动Ability,包含Want类型参数,以及可选填的StartOption类型参数。通过Promise方法返回结果。
**模型约束**
: 此接口仅可在Stage模型下使用。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**参数:**
**参数:**
...
@@ -78,7 +82,7 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
...
@@ -78,7 +82,7 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
**示例:**
**示例:**
```
j
s
```
t
s
let
want
=
{
let
want
=
{
'
bundleName
'
:
'
com.example.myapp
'
,
'
bundleName
'
:
'
com.example.myapp
'
,
'
abilityName
'
:
'
MyAbility
'
'
abilityName
'
:
'
MyAbility
'
...
@@ -94,7 +98,9 @@ this.context.startAbility(want).then((data) => {
...
@@ -94,7 +98,9 @@ this.context.startAbility(want).then((data) => {
startAbility(want: Want, options: StartOptions, callback: AsyncCallback
<
void
>
): void
startAbility(want: Want, options: StartOptions, callback: AsyncCallback
<
void
>
): void
启动Ability,包含有两个参数,Want类型和StartOption类型参数。callback形式返回启动结果。
启动Ability。使用callback异步回调。
**模型约束**
: 此接口仅可在Stage模型下使用。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
@@ -104,11 +110,11 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
...
@@ -104,11 +110,11 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-Want.md
)
| 是 | 启动Ability的want信息。 |
| want |
[
Want
](
js-apis-application-Want.md
)
| 是 | 启动Ability的want信息。 |
| options |
[
StartOptions
](
js-apis-application-StartOptions.md
)
| 是 | 启动Ability所携带的参数。 |
| options |
[
StartOptions
](
js-apis-application-StartOptions.md
)
| 是 | 启动Ability所携带的参数。 |
| callback | AsyncCallback
<
void
>
| 是 |
callback形式返回启动结果。
|
| callback | AsyncCallback
<
void
>
| 是 |
回调函数。当启动Ability成功,err为undefined;否则为错误对象。
|
**示例:**
**示例:**
```
j
s
```
t
s
let
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
'
deviceId
'
:
''
,
'
bundleName
'
:
'
com.extreme.test
'
,
'
bundleName
'
:
'
com.extreme.test
'
,
...
@@ -126,7 +132,9 @@ this.context.startAbility(want, options, (error) => {
...
@@ -126,7 +132,9 @@ this.context.startAbility(want, options, (error) => {
terminateSelf(callback: AsyncCallback
<
void
>
): void;
terminateSelf(callback: AsyncCallback
<
void
>
): void;
停止输入法应用自身,通过Callback方法返回接口调用是否成功。
停止输入法应用自身。使用callback异步回调。
**模型约束**
: 此接口仅可在Stage模型下使用。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
@@ -134,11 +142,11 @@ terminateSelf(callback: AsyncCallback<void>): void;
...
@@ -134,11 +142,11 @@ terminateSelf(callback: AsyncCallback<void>): void;
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------------- |
| -------- | ------------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
,返回接口调用是否成功的结果
。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数
。当启动Ability成功,err为undefined;否则为错误对象
。 |
**示例:**
**示例:**
```
j
s
```
t
s
this
.
context
.
terminateSelf
((
err
)
=>
{
this
.
context
.
terminateSelf
((
err
)
=>
{
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -150,6 +158,8 @@ terminateSelf(): Promise<void>;
...
@@ -150,6 +158,8 @@ terminateSelf(): Promise<void>;
停止输入法应用自身。通过Promise返回结果。
停止输入法应用自身。通过Promise返回结果。
**模型约束**
: 此接口仅可在Stage模型下使用。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**返回值:**
**返回值:**
...
@@ -160,7 +170,7 @@ terminateSelf(): Promise<void>;
...
@@ -160,7 +170,7 @@ terminateSelf(): Promise<void>;
**示例:**
**示例:**
```
j
s
```
t
s
this
.
context
.
terminateSelf
().
then
((
data
)
=>
{
this
.
context
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
'
success:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
success:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
ae36ff33
...
@@ -59,7 +59,7 @@ getController(): InputMethodController
...
@@ -59,7 +59,7 @@ getController(): InputMethodController
**示例:**
**示例:**
```
j
s
```
t
s
let
InputMethodController
=
inputMethod
.
getController
();
let
InputMethodController
=
inputMethod
.
getController
();
```
```
...
@@ -79,10 +79,9 @@ getSetting(): InputMethodSetting
...
@@ -79,10 +79,9 @@ getSetting(): InputMethodSetting
| ----------------------------------------- | ---------------------------- |
| ----------------------------------------- | ---------------------------- |
|
[
InputMethodSetting
](
#inputmethodsetting8
)
| 回调返回当前客户端设置实例。 |
|
[
InputMethodSetting
](
#inputmethodsetting8
)
| 回调返回当前客户端设置实例。 |
**示例:**
**示例:**
```
j
s
```
t
s
let
InputMethodSetting
=
inputMethod
.
getSetting
();
let
InputMethodSetting
=
inputMethod
.
getSetting
();
```
```
...
@@ -90,7 +89,7 @@ let InputMethodSetting = inputMethod.getSetting();
...
@@ -90,7 +89,7 @@ let InputMethodSetting = inputMethod.getSetting();
switchInputMethod(target: InputMethodProperty, callback: AsyncCallback
<
boolean
>
): void
switchInputMethod(target: InputMethodProperty, callback: AsyncCallback
<
boolean
>
): void
切换输入法。
此接口仅可在Stage模型下使用。使用callback形式返回结果。参数个数为2,否则抛出异常
。
切换输入法。
使用callback异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -100,15 +99,14 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
...
@@ -100,15 +99,14 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
|target |
[
InputMethodProperty
](
#inputmethodproperty8
)
| 是 | 传入要切换的目标输入法。 |
| target |
[
InputMethodProperty
](
#inputmethodproperty8
)
| 是 | 传入要切换的目标输入法。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 返回输入法切换是否成功。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 回调函数。当输入法切换成功,err为undefined,data为true;否则为错误对象。 |
**示例:**
**示例:**
```
j
s
```
t
s
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
)
{
...
@@ -128,7 +126,7 @@ try{
...
@@ -128,7 +126,7 @@ try{
## inputMethod.switchInputMethod<sup>9+</sup>
## inputMethod.switchInputMethod<sup>9+</sup>
switchInputMethod(target: InputMethodProperty): Promise
<
boolean
>
switchInputMethod(target: InputMethodProperty): Promise
<
boolean
>
切换输入法。
此接口仅可在Stage模型下使用。使用promise形式返回结果。参数个数为1,否则抛出异常
。
切换输入法。
使用promise异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -146,20 +144,20 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
...
@@ -146,20 +144,20 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------- | ---------------------------- |
| ----------------------------------------- | ---------------------------- |
| Promise
\<
boolean> |
回调返回切换后的输入法
。 |
| Promise
\<
boolean> |
Promise对象。返回true表示切换输入法成功;返回false表示切换输入法失败
。 |
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
}).
then
((
result
)
=>
{
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
}).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to switchInputMethod.
(promise)
'
);
console
.
info
(
'
Success to switchInputMethod.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchInputMethod.
(promise)
'
);
console
.
error
(
'
Failed to switchInputMethod.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchInputMethod
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
switchInputMethod err:
'
+
JSON
.
stringify
(
err
));
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
switchInputMethod err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
switchInputMethod err:
'
+
JSON
.
stringify
(
err
));
...
@@ -170,7 +168,7 @@ try {
...
@@ -170,7 +168,7 @@ try {
getCurrentInputMethod(): InputMethodProperty
getCurrentInputMethod(): InputMethodProperty
获取当前输入法扩展应用,提供同步接口,返回当前输入法属性
对象
。
获取当前输入法扩展应用,提供同步接口,返回当前输入法属性。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -184,7 +182,7 @@ getCurrentInputMethod(): InputMethodProperty
...
@@ -184,7 +182,7 @@ getCurrentInputMethod(): InputMethodProperty
**示例:**
**示例:**
```
j
s
```
t
s
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
```
```
...
@@ -192,7 +190,7 @@ let currentIme = inputMethod.getCurrentInputMethod();
...
@@ -192,7 +190,7 @@ let currentIme = inputMethod.getCurrentInputMethod();
switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback
\<
boolean>): void
switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback
\<
boolean>): void
在当前输入法应用内切换子类型。
在当前输入法应用内切换子类型。
使用callback异步回调。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -204,12 +202,12 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
...
@@ -204,12 +202,12 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
|target |
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 传入要切换的目标输入法子类型。 |
|
target |
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 传入要切换的目标输入法子类型。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
返回输入法子类型切换是否成功。
|
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当输入法子类型切换成功,err为undefined,data为true;否则为错误对象。
|
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodSubtype
=
{
let
inputMethodSubtype
=
{
id
:
"
com.example.kikainput
"
,
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
label
:
"
ServiceExtAbility
"
...
@@ -235,7 +233,7 @@ try {
...
@@ -235,7 +233,7 @@ try {
switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise
<
boolean
>
switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise
<
boolean
>
在当前输入法应用内切换子类型。
此接口仅可在Stage模型下使用。使用promise形式返回结果。参数个数为1,否则抛出异常
。
在当前输入法应用内切换子类型。
使用promise异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -251,7 +249,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean&
...
@@ -251,7 +249,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean&
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodSubtype
=
{
let
inputMethodSubtype
=
{
id
:
"
com.example.kikainput
"
,
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
label
:
"
ServiceExtAbility
"
...
@@ -259,9 +257,9 @@ let inputMethodSubtype = {
...
@@ -259,9 +257,9 @@ let inputMethodSubtype = {
try
{
try
{
inputMethod
.
switchCurrentInputMethodSubtype
(
inputMethodSubtype
).
then
((
result
)
=>
{
inputMethod
.
switchCurrentInputMethodSubtype
(
inputMethodSubtype
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to switchCurrentInputMethodSubtype.
(promise)
'
);
console
.
info
(
'
Success to switchCurrentInputMethodSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.
(promise)
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchCurrentInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
switchCurrentInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
...
@@ -289,7 +287,7 @@ getCurrentInputMethodSubtype(): InputMethodSubtype
...
@@ -289,7 +287,7 @@ getCurrentInputMethodSubtype(): InputMethodSubtype
**示例:**
**示例:**
```
j
s
```
t
s
let
currentImeSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
let
currentImeSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
```
```
...
@@ -297,7 +295,7 @@ let currentImeSubType = inputMethod.getCurrentInputMethodSubtype();
...
@@ -297,7 +295,7 @@ let currentImeSubType = inputMethod.getCurrentInputMethodSubtype();
switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback
\<
boolean>): void
switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback
\<
boolean>): void
切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。
切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。
使用callback异步回调。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -311,11 +309,11 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
...
@@ -311,11 +309,11 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
|inputMethodProperty |
[
InputMethodProperty
](
#inputmethodproperty8
)
| 是 | 传入要切换的目标输入法。 |
|inputMethodProperty |
[
InputMethodProperty
](
#inputmethodproperty8
)
| 是 | 传入要切换的目标输入法。 |
|inputMethodSubtype |
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 传入要切换的目标输入法子类型。 |
|inputMethodSubtype |
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 传入要切换的目标输入法子类型。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
返回输入法和子类型切换是否成功
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当输入法和子类型切换成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodProperty
=
{
let
inputMethodProperty
=
{
packageName
:
"
com.example.kikakeyboard
"
,
packageName
:
"
com.example.kikakeyboard
"
,
methodId
:
"
ServiceExtAbility
"
methodId
:
"
ServiceExtAbility
"
...
@@ -362,7 +360,7 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
...
@@ -362,7 +360,7 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodProperty
=
{
let
inputMethodProperty
=
{
name
:
"
com.example.kikakeyboard
"
,
name
:
"
com.example.kikakeyboard
"
,
id
:
"
ServiceExtAbility
"
id
:
"
ServiceExtAbility
"
...
@@ -378,15 +376,15 @@ let inputMethodSubProperty = {
...
@@ -378,15 +376,15 @@ let inputMethodSubProperty = {
try
{
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
).
then
((
result
)
=>
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to switchCurrentInputMethodAndSubtype.
(promise)
'
);
console
.
info
(
'
Success to switchCurrentInputMethodAndSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
(promise)
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchCurrentInputMethodAndSubtype
promise
err:
'
+
err
);
console
.
error
(
'
switchCurrentInputMethodAndSubtype err:
'
+
err
);
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
switchCurrentInputMethodAndSubtype
promise
err:
'
+
err
);
console
.
error
(
'
switchCurrentInputMethodAndSubtype err:
'
+
err
);
}
}
```
```
...
@@ -444,7 +442,7 @@ let InputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -444,7 +442,7 @@ let InputMethodSetting = inputMethod.getInputMethodSetting();
stopInputSession(callback: AsyncCallback
<
boolean
>
): void
stopInputSession(callback: AsyncCallback
<
boolean
>
): void
隐藏输入法。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
隐藏输入法。使用callback
异步回调
。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
@@ -452,7 +450,7 @@ stopInputSession(callback: AsyncCallback<boolean>): void
...
@@ -452,7 +450,7 @@ stopInputSession(callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
boolean
>
| 是 |
返回输入法隐藏是否成功
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当输入法隐藏成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -478,7 +476,7 @@ try {
...
@@ -478,7 +476,7 @@ try {
stopInputSession(): Promise
<
boolean
>
<sup>
9+
</sup>
stopInputSession(): Promise
<
boolean
>
<sup>
9+
</sup>
隐藏输入法。使用promise
形式返回结果
。
隐藏输入法。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -486,7 +484,7 @@ stopInputSession(): Promise<boolean><sup>9+</sup>
...
@@ -486,7 +484,7 @@ stopInputSession(): Promise<boolean><sup>9+</sup>
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
boolean
>
|
返回输入法隐藏是否成功
。 |
| Promise
<
boolean
>
|
Promise对象。返回true表示输入法隐藏成功;返回false表示输入法隐藏失败
。 |
**示例:**
**示例:**
...
@@ -494,9 +492,9 @@ stopInputSession(): Promise<boolean><sup>9+</sup>
...
@@ -494,9 +492,9 @@ stopInputSession(): Promise<boolean><sup>9+</sup>
try
{
try
{
InputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
InputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to stopInputSession.
(promise)
'
);
console
.
info
(
'
Success to stopInputSession.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInputSession.
(promise)
'
);
console
.
error
(
'
Failed to stopInputSession.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
stopInputSession err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
stopInputSession err:
'
+
JSON
.
stringify
(
err
));
...
@@ -510,7 +508,7 @@ try {
...
@@ -510,7 +508,7 @@ try {
showSoftKeyboard(callback: AsyncCallback
<
void
>
): void
showSoftKeyboard(callback: AsyncCallback
<
void
>
): void
显示软键盘
,使用callback异步回调。参数个数为1,否则抛出异常
。
显示软键盘
。使用callback异步回调
。
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
...
@@ -520,7 +518,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
...
@@ -520,7 +518,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
| 参数名 | 参数类型 | 必填 | 说明 |
| 参数名 | 参数类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
当软键盘显示成功。err为undefined,否则为错误对象。
|
**示例:**
**示例:**
...
@@ -538,7 +536,7 @@ InputMethodController.showSoftKeyboard((err) => {
...
@@ -538,7 +536,7 @@ InputMethodController.showSoftKeyboard((err) => {
showSoftKeyboard(): Promise
<
void
>
showSoftKeyboard(): Promise
<
void
>
显示软键盘,使用Promise异步回调。
参数个数为0,否则抛出异常。
显示软键盘,使用Promise异步回调。
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
...
@@ -548,7 +546,7 @@ showSoftKeyboard(): Promise<void>
...
@@ -548,7 +546,7 @@ showSoftKeyboard(): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------- | ------------------------- |
| ------------------- | ------------------------- |
| Promise
<
void
>
| 无返回结果的Promise对象。 |
| Promise
<
void
>
|
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
...
@@ -556,7 +554,7 @@ showSoftKeyboard(): Promise<void>
...
@@ -556,7 +554,7 @@ showSoftKeyboard(): Promise<void>
InputMethodController
.
showSoftKeyboard
().
then
(
async
(
err
)
=>
{
InputMethodController
.
showSoftKeyboard
().
then
(
async
(
err
)
=>
{
console
.
log
(
'
showSoftKeyboard success
'
);
console
.
log
(
'
showSoftKeyboard success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
showSoftKeyboard
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
showSoftKeyboard err:
'
+
JSON
.
stringify
(
err
));
});
});
```
```
...
@@ -564,7 +562,7 @@ InputMethodController.showSoftKeyboard().then(async (err) => {
...
@@ -564,7 +562,7 @@ InputMethodController.showSoftKeyboard().then(async (err) => {
hideSoftKeyboard(callback: AsyncCallback
<
void
>
): void
hideSoftKeyboard(callback: AsyncCallback
<
void
>
): void
隐藏软键盘
,使用callback异步回调。参数个数为1,否则抛出异常
。
隐藏软键盘
。使用callback异步回调
。
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
**需要权限**
: ohos.permission.CONNECT_IME_ABILITY
...
@@ -574,7 +572,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
...
@@ -574,7 +572,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
| 参数名 | 参数类型 | 必填 | 说明 |
| 参数名 | 参数类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
当软键盘隐藏成功。err为undefined,否则为错误对象。
|
**示例:**
**示例:**
...
@@ -602,7 +600,7 @@ hideSoftKeyboard(): Promise<void>
...
@@ -602,7 +600,7 @@ hideSoftKeyboard(): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------- | ------------------------- |
| ------------------- | ------------------------- |
| Promise
<
void
>
| 无返回结果的Promise对象。 |
| Promise
<
void
>
|
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
...
@@ -610,7 +608,7 @@ hideSoftKeyboard(): Promise<void>
...
@@ -610,7 +608,7 @@ hideSoftKeyboard(): Promise<void>
InputMethodController
.
hideSoftKeyboard
().
then
(
async
(
err
)
=>
{
InputMethodController
.
hideSoftKeyboard
().
then
(
async
(
err
)
=>
{
console
.
log
(
'
hideSoftKeyboard success
'
);
console
.
log
(
'
hideSoftKeyboard success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
hideSoftKeyboard
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
hideSoftKeyboard err:
'
+
JSON
.
stringify
(
err
));
});
});
```
```
...
@@ -618,7 +616,7 @@ InputMethodController.hideSoftKeyboard().then(async (err) => {
...
@@ -618,7 +616,7 @@ InputMethodController.hideSoftKeyboard().then(async (err) => {
stopInput(callback: AsyncCallback
<
boolean
>
): void
stopInput(callback: AsyncCallback
<
boolean
>
): void
隐藏输入法。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
隐藏输入法。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代
> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代
...
@@ -629,7 +627,7 @@ stopInput(callback: AsyncCallback<boolean>): void
...
@@ -629,7 +627,7 @@ stopInput(callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
boolean
>
| 是 |
返回输入法隐藏是否成功
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当输入法隐藏成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -651,7 +649,7 @@ InputMethodController.stopInput((error, result) => {
...
@@ -651,7 +649,7 @@ InputMethodController.stopInput((error, result) => {
stopInput(): Promise
<
boolean
>
stopInput(): Promise
<
boolean
>
隐藏输入法。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
隐藏输入法。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代
> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代
...
@@ -662,19 +660,19 @@ stopInput(): Promise<boolean>
...
@@ -662,19 +660,19 @@ stopInput(): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
boolean
>
|
返回输入法隐藏是否成功
。 |
| Promise
<
boolean
>
|
Promise对象。返回true表示输入法隐藏成功;返回false表示输入法隐藏失败
。 |
**示例:**
**示例:**
```
js
```
js
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to stopInput.
(promise)
'
);
console
.
info
(
'
Success to stopInput.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInput.
(promise)
'
);
console
.
error
(
'
Failed to stopInput.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
stopInput
promise
err:
'
+
err
);
console
.
error
(
'
stopInput err:
'
+
err
);
})
})
```
```
...
@@ -686,7 +684,7 @@ InputMethodController.stopInput().then((result) => {
...
@@ -686,7 +684,7 @@ InputMethodController.stopInput().then((result) => {
on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void
on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void
订阅输入法及子类型变化监听事件
,使用callback回调返回变化了的输入法及子类型的相关实例。参数个数为3,参数1和参数2为napi_object,参数3为napi_function,否则抛出异常
。
订阅输入法及子类型变化监听事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -695,7 +693,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
...
@@ -695,7 +693,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 |
| callback |
[
InputMethodProperty
](
#inputmethodproperty8
)
,
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 回调
返回输入法及子类型相关实例
。 |
| callback |
[
InputMethodProperty
](
#inputmethodproperty8
)
,
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 是 | 回调
函数,返回输入法属性对象及输入法子类型对象
。 |
**示例:**
**示例:**
...
@@ -710,7 +708,7 @@ InputMethodEngine.on('imeChange', (inputMethodProperty, inputMethodSubtype) => {
...
@@ -710,7 +708,7 @@ InputMethodEngine.on('imeChange', (inputMethodProperty, inputMethodSubtype) => {
on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void
on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void
取消订阅输入法及子类型变化监听事件
,使用callback回调返回取消订阅的输入法及子类型的相关实例。必选参数个数为1,参数1为string,可选参数2为napi_function,否则抛出异常
。
取消订阅输入法及子类型变化监听事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -719,7 +717,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
...
@@ -719,7 +717,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 |
| callback |
[
InputMethodProperty
](
#inputmethodproperty8
)
,
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 否 | 回调
返回输入法及子类型相关实例
。 |
| callback |
[
InputMethodProperty
](
#inputmethodproperty8
)
,
[
InputMethodSubtype
](
./js-apis-inputmethodsubtype.md#inputmethodsubtype
)
| 否 | 回调
函数,返回取消订阅的输入法属性对象及输入法子类型对象
。 |
**示例:**
**示例:**
...
@@ -731,7 +729,7 @@ InputMethodAbility.off('imeChange');
...
@@ -731,7 +729,7 @@ InputMethodAbility.off('imeChange');
listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback
<
Array
<
InputMethodSubtype
>>
): void
listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback
<
Array
<
InputMethodSubtype
>>
): void
获取指定输入法应用的所有子类型。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取指定输入法应用的所有子类型。使用callback
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -742,11 +740,11 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
...
@@ -742,11 +740,11 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| inputMethodProperty | InputMethodProperty| 是 | 指定获取子类型所属的输入法应用
| inputMethodProperty | InputMethodProperty| 是 | 指定获取子类型所属的输入法应用
| callback | Array
<
[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
| 是
| 返回已安装输入法列表
。 |
| callback | Array
<
[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
| 是
| 回调函数,返回指定输入法应用的所有子类型
。 |
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodProperty
=
{
let
inputMethodProperty
=
{
packageName
:
'
com.example.kikakeyboard
'
,
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
methodId
:
'
com.example.kikakeyboard
'
...
@@ -768,7 +766,7 @@ try {
...
@@ -768,7 +766,7 @@ try {
listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise
<
Array
<
InputMethodSubtype
>>
listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise
<
Array
<
InputMethodSubtype
>>
获取指定输入法应用的所有子类型。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
获取指定输入法应用的所有子类型。使用promise
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -784,11 +782,11 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Arr
...
@@ -784,11 +782,11 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Arr
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ---------------------- |
| ----------------------------------------------------------- | ---------------------- |
| Promise
<Array
<[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
> | 返回已安装输入法子类型列表。 |
| Promise
<Array
<[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
> |
Promise对象,
返回已安装输入法子类型列表。 |
**示例:**
**示例:**
```
j
s
```
t
s
let
inputMethodSubProperty
=
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
label
:
"
ServiceExtAbility
"
...
@@ -808,7 +806,7 @@ try {
...
@@ -808,7 +806,7 @@ try {
listCurrentInputMethodSubtype(callback: AsyncCallback
<
Array
<
InputMethodSubtype
>>
): void
listCurrentInputMethodSubtype(callback: AsyncCallback
<
Array
<
InputMethodSubtype
>>
): void
查询当前输入法
的子类型列表。使用callback形式返回结果。参数个数为1,否则抛出异常
。
查询当前输入法
应用的所有子类型。使用callback异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -818,11 +816,11 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
...
@@ -818,11 +816,11 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | Array
<
[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
| 是 |
返回当前输入法的子类型列表
。 |
| callback | Array
<
[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
| 是 |
回调函数,返回当前输入法应用的所有子类型
。 |
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
InputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -840,7 +838,7 @@ try {
...
@@ -840,7 +838,7 @@ try {
listCurrentInputMethodSubtype(): Promise
<
Array
<
InputMethodSubtype
>>
listCurrentInputMethodSubtype(): Promise
<
Array
<
InputMethodSubtype
>>
查询当前输入法的子类型列表。使用promise
形式返回结果
。
查询当前输入法的子类型列表。使用promise
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -850,16 +848,16 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
...
@@ -850,16 +848,16 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ---------------------- |
| ----------------------------------------------------------- | ---------------------- |
| Promise
<Array
<[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
> | 返回当前输入法的子类型列表。 |
| Promise
<Array
<[
InputMethodSubtype
](./
js-apis-inputmethodsubtype.md#inputmethodsubtype
)
>
> |
Promise对象,
返回当前输入法的子类型列表。 |
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
InputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
console
.
info
(
'
listCurrentInputMethodSubtype success
'
);
console
.
info
(
'
listCurrentInputMethodSubtype success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
listCurrentInputMethodSubtype
promise
err:
'
+
err
);
console
.
error
(
'
listCurrentInputMethodSubtype err:
'
+
err
);
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
listCurrentInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
listCurrentInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
...
@@ -870,7 +868,7 @@ try {
...
@@ -870,7 +868,7 @@ try {
getInputMethods(enable: boolean, callback: AsyncCallback
<
Array
<
InputMethodProperty
>>
): void
getInputMethods(enable: boolean, callback: AsyncCallback
<
Array
<
InputMethodProperty
>>
): void
获取已激活/未激活输入法列表。参数enable取true,返回已激活输入法列表,取false返回未激活输入法列表。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取已激活/未激活输入法列表。参数enable取true,返回已激活输入法列表,取false返回未激活输入法列表。使用callback
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -881,11 +879,11 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
...
@@ -881,11 +879,11 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------- | ---- | ----------------------------- |
| -------- | --------------------------------------------------- | ---- | ----------------------------- |
| enable | boolean | 是 | 指定返回已激活/未激活。 |
| enable | boolean | 是 | 指定返回已激活/未激活。 |
| callback | Array
<
[
InputMethodProperty
](
#inputmethodproperty8
)
>
| 是 | 返回已激活/未激活输入法列表。 |
| callback | Array
<
[
InputMethodProperty
](
#inputmethodproperty8
)
>
| 是 |
回调函数,
返回已激活/未激活输入法列表。 |
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
InputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -903,7 +901,7 @@ try {
...
@@ -903,7 +901,7 @@ try {
getInputMethods(enable: boolean): Promise
<
Array
<
InputMethodProperty
>>
getInputMethods(enable: boolean): Promise
<
Array
<
InputMethodProperty
>>
获取已激活/未激活输入法列表。参数enable取true返回已激活输入法列表,取false返回未激活输入法列表。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
获取已激活/未激活输入法列表。参数enable取true返回已激活输入法列表,取false返回未激活输入法列表。使用promise
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -919,19 +917,19 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
...
@@ -919,19 +917,19 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------------------------------------ | ----------------------------- |
| ------------------------------------------------------------ | ----------------------------- |
| Promise
<Array
<[
InputMethodProperty
](
#inputmethodproperty8
)
>
> | 返回已激活/未激活输入法列表。 |
| Promise
<Array
<[
InputMethodProperty
](
#inputmethodproperty8
)
>
> |
Promise对象,
返回已激活/未激活输入法列表。 |
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
InputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
console
.
info
(
'
getInputMethods success
'
);
console
.
info
(
'
getInputMethods success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getInputMethods
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getInputMethods err:
'
+
JSON
.
stringify
(
err
));
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
getInputMethods
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getInputMethods err:
'
+
JSON
.
stringify
(
err
));
}
}
```
```
...
@@ -939,7 +937,7 @@ try {
...
@@ -939,7 +937,7 @@ try {
showOptionalInputMethods(callback: AsyncCallback
<
void
>
): void
showOptionalInputMethods(callback: AsyncCallback
<
void
>
): void
显示输入法选择对话框。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
显示输入法选择对话框。使用callback
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -951,11 +949,11 @@ showOptionalInputMethods(callback: AsyncCallback<void>): void
...
@@ -951,11 +949,11 @@ showOptionalInputMethods(callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
当输入法选择对话框显示成功。err为undefined,否则为错误对象。
|
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputMethodSetting
.
showOptionalInputMethods
((
err
)
=>
{
InputMethodSetting
.
showOptionalInputMethods
((
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -973,7 +971,7 @@ try {
...
@@ -973,7 +971,7 @@ try {
showOptionalInputMethods(): Promise
<
void
>
showOptionalInputMethods(): Promise
<
void
>
显示输入法选择对话框。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
显示输入法选择对话框。使用promise
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -985,15 +983,15 @@ showOptionalInputMethods(): Promise<void>
...
@@ -985,15 +983,15 @@ showOptionalInputMethods(): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
void
>
| 无返回结果的Promise对象。 |
| Promise
<
void
>
|
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
```
j
s
```
t
s
InputMethodSetting
.
showOptionalInputMethods
().
then
(()
=>
{
InputMethodSetting
.
showOptionalInputMethods
().
then
(()
=>
{
console
.
info
(
'
displayOptionalInputMethod success.
(promise)
'
);
console
.
info
(
'
displayOptionalInputMethod success.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
displayOptionalInputMethod
promise
err:
'
+
err
);
console
.
error
(
'
displayOptionalInputMethod err:
'
+
err
);
})
})
```
```
...
@@ -1001,7 +999,7 @@ InputMethodSetting.showOptionalInputMethods().then(() => {
...
@@ -1001,7 +999,7 @@ InputMethodSetting.showOptionalInputMethods().then(() => {
listInputMethod(callback: AsyncCallback
<
Array
<
InputMethodProperty
>>
): void
listInputMethod(callback: AsyncCallback
<
Array
<
InputMethodProperty
>>
): void
查询已安装的输入法列表。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
查询已安装的输入法列表。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9)替代
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9)替代
...
@@ -1012,7 +1010,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
...
@@ -1012,7 +1010,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | Array
<
[
InputMethodProperty
](
#inputmethodproperty8
)
>
| 是 |
返回已安装
输入法列表。 |
| callback | Array
<
[
InputMethodProperty
](
#inputmethodproperty8
)
>
| 是 |
回调函数,返回已安装的
输入法列表。 |
**示例:**
**示例:**
...
@@ -1030,7 +1028,7 @@ InputMethodSetting.listInputMethod((err,data) => {
...
@@ -1030,7 +1028,7 @@ InputMethodSetting.listInputMethod((err,data) => {
listInputMethod(): Promise
<
Array
<
InputMethodProperty
>>
listInputMethod(): Promise
<
Array
<
InputMethodProperty
>>
查询已安装的输入法列表。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
查询已安装的输入法列表。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9-1)替代
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9-1)替代
...
@@ -1041,7 +1039,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
...
@@ -1041,7 +1039,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ---------------------- |
| ----------------------------------------------------------- | ---------------------- |
| Promise
<Array
<[
InputMethodProperty
](
#inputmethodproperty8
)
>
> | 返回已安装输入法列表。 |
| Promise
<Array
<[
InputMethodProperty
](
#inputmethodproperty8
)
>
> |
Promise对象,
返回已安装输入法列表。 |
**示例:**
**示例:**
...
@@ -1049,7 +1047,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
...
@@ -1049,7 +1047,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
'
listInputMethod success
'
);
console
.
info
(
'
listInputMethod success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
listInputMethod
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
listInputMethod err:
'
+
JSON
.
stringify
(
err
));
})
})
```
```
...
@@ -1057,7 +1055,7 @@ InputMethodSetting.listInputMethod().then((data) => {
...
@@ -1057,7 +1055,7 @@ InputMethodSetting.listInputMethod().then((data) => {
displayOptionalInputMethod(callback: AsyncCallback
<
void
>
): void
displayOptionalInputMethod(callback: AsyncCallback
<
void
>
): void
显示输入法选择对话框。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
显示输入法选择对话框。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9)替代
> 从API version 8开始支持,从API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9)替代
...
@@ -1068,7 +1066,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
...
@@ -1068,7 +1066,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
当输入法选择对话框显示成功。err为undefined,否则为错误对象。
|
**示例:**
**示例:**
...
@@ -1086,7 +1084,7 @@ InputMethodSetting.displayOptionalInputMethod((err) => {
...
@@ -1086,7 +1084,7 @@ InputMethodSetting.displayOptionalInputMethod((err) => {
displayOptionalInputMethod(): Promise
<
void
>
displayOptionalInputMethod(): Promise
<
void
>
显示输入法选择对话框。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
显示输入法选择对话框。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9-1)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9-1)替代
...
@@ -1097,14 +1095,14 @@ displayOptionalInputMethod(): Promise<void>
...
@@ -1097,14 +1095,14 @@ displayOptionalInputMethod(): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
void
>
| 无返回结果的Promise对象。 |
| Promise
<
void
>
|
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
```
js
```
js
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
'
displayOptionalInputMethod success
.(promise)
'
);
console
.
info
(
'
displayOptionalInputMethod success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
displayOptionalInputMethod
promise
err:
'
+
err
);
console
.
error
(
'
displayOptionalInputMethod err:
'
+
err
);
})
})
```
```
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
ae36ff33
...
@@ -145,7 +145,7 @@ let KeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
...
@@ -145,7 +145,7 @@ let KeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void
on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void
订阅输入法绑定成功事件
,使用callback回调返回输入法操作相关实例。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅输入法绑定成功事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -154,7 +154,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
...
@@ -154,7 +154,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
)
| 是 | 回调
函数,返回订阅输入法的KeyboardController和TextInputClient
实例。 |
**示例:**
**示例:**
...
@@ -178,7 +178,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
...
@@ -178,7 +178,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
)
| 否 | 回调
函数,返回取消订阅的KeyboardController和TextInputClient
实例。 |
...
@@ -194,7 +194,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textIn
...
@@ -194,7 +194,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textIn
on(type: 'inputStop', callback: () => void): void
on(type: 'inputStop', callback: () => void): void
订阅停止输入法应用事件
,使用callback
回调。
订阅停止输入法应用事件
。使用callback异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -217,7 +217,7 @@ inputMethodEngine.getInputMethodEngine().on('inputStop', () => {
...
@@ -217,7 +217,7 @@ inputMethodEngine.getInputMethodEngine().on('inputStop', () => {
off(type: 'inputStop', callback: () => void): void
off(type: 'inputStop', callback: () => void): void
取消订阅停止输入法应用事件。使用callback回调。
取消订阅停止输入法应用事件。使用callback
异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -240,7 +240,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStop', () => {
...
@@ -240,7 +240,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStop', () => {
on(type: 'setCallingWindow', callback: (wid:number) => void): void
on(type: 'setCallingWindow', callback: (wid:number) => void): void
订阅设置调用窗口事件
,使用callback
回调。
订阅设置调用窗口事件
。使用callback异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -249,7 +249,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
...
@@ -249,7 +249,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 调用方window id。 |
| callback | number | 是 |
回调函数,返回
调用方window id。 |
**示例:**
**示例:**
...
@@ -263,7 +263,7 @@ inputMethodEngine.getInputMethodEngine().on('setCallingWindow', (wid) => {
...
@@ -263,7 +263,7 @@ inputMethodEngine.getInputMethodEngine().on('setCallingWindow', (wid) => {
off(type: 'setCallingWindow', callback: (wid:number) => void): void
off(type: 'setCallingWindow', callback: (wid:number) => void): void
取消订阅设置调用窗口事件。使用callback回调。
取消订阅设置调用窗口事件。使用callback
异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -272,7 +272,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
...
@@ -272,7 +272,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 调用方window id。 |
| callback | number | 是 |
回调函数,返回
调用方window id。 |
**示例:**
**示例:**
...
@@ -286,7 +286,7 @@ inputMethodEngine.getInputMethodEngine().off('setCallingWindow', () => {
...
@@ -286,7 +286,7 @@ inputMethodEngine.getInputMethodEngine().off('setCallingWindow', () => {
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
订阅输入法事件。
参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅输入法事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -312,7 +312,7 @@ inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => {
...
@@ -312,7 +312,7 @@ inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => {
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
取消订阅输入法事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅输入法事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -342,7 +342,7 @@ inputMethodEngine.getInputMethodEngine().off('keyboardHide', () => {
...
@@ -342,7 +342,7 @@ inputMethodEngine.getInputMethodEngine().off('keyboardHide', () => {
on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void
on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void
订阅输入法绑定成功事件
,使用callback回调返回输入法操作相关实例。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅输入法绑定成功事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -351,7 +351,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient:
...
@@ -351,7 +351,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient:
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘inputStart’时表示订阅输入法绑定。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘inputStart’时表示订阅输入法绑定。 |
| callback |
[
KeyboardController
](
#keyboardcontroller
)
,
[
InputClient
](
#inputclient-9
)
| 是 | 回调返回输入法操作相关实例。 |
| callback |
[
KeyboardController
](
#keyboardcontroller
)
,
[
InputClient
](
#inputclient-9
)
| 是 | 回调
函数,
返回输入法操作相关实例。 |
**示例:**
**示例:**
...
@@ -366,7 +366,7 @@ inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, inputC
...
@@ -366,7 +366,7 @@ inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, inputC
off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void
off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void
取消订阅输入法绑定成功事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅输入法绑定成功事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -375,7 +375,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClien
...
@@ -375,7 +375,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
)
| 否 | 回调
函数,
返回输入法操作相关实例。 |
**示例:**
**示例:**
...
@@ -389,7 +389,7 @@ inputMethodEngine.getInputMethodAbility().off('inputStart', (kbController, input
...
@@ -389,7 +389,7 @@ inputMethodEngine.getInputMethodAbility().off('inputStart', (kbController, input
on(type: 'inputStop', callback: () => void): void
on(type: 'inputStop', callback: () => void): void
订阅停止输入法应用事件
,使用callback
回调。
订阅停止输入法应用事件
。使用callback异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -412,7 +412,7 @@ inputMethodEngine.getInputMethodAbility().on('inputStop', () => {
...
@@ -412,7 +412,7 @@ inputMethodEngine.getInputMethodAbility().on('inputStop', () => {
off(type: 'inputStop', callback: () => void): void
off(type: 'inputStop', callback: () => void): void
取消订阅停止输入法应用事件。使用callback回调。
取消订阅停止输入法应用事件。使用callback
异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -435,7 +435,7 @@ inputMethodEngine.getInputMethodAbility().off('inputStop', () => {
...
@@ -435,7 +435,7 @@ inputMethodEngine.getInputMethodAbility().off('inputStop', () => {
on(type: 'setCallingWindow', callback: (wid:number) => void): void
on(type: 'setCallingWindow', callback: (wid:number) => void): void
订阅设置调用窗口事件
,使用callback
回调。
订阅设置调用窗口事件
。使用callback异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -444,7 +444,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
...
@@ -444,7 +444,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 调用方window id。 |
| callback | number | 是 |
回调函数,返回
调用方window id。 |
**示例:**
**示例:**
...
@@ -458,7 +458,7 @@ inputMethodEngine.getInputMethodAbility().on('setCallingWindow', (wid) => {
...
@@ -458,7 +458,7 @@ inputMethodEngine.getInputMethodAbility().on('setCallingWindow', (wid) => {
off(type: 'setCallingWindow', callback: (wid:number) => void): void
off(type: 'setCallingWindow', callback: (wid:number) => void): void
取消订阅设置调用窗口事件。使用callback回调。
取消订阅设置调用窗口事件。使用callback
异步
回调。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -467,7 +467,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
...
@@ -467,7 +467,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 调用方window id。 |
| callback | number | 是 |
回调函数,返回
调用方window id。 |
**示例:**
**示例:**
...
@@ -481,7 +481,7 @@ inputMethodEngine.getInputMethodAbility().off('setCallingWindow', () => {
...
@@ -481,7 +481,7 @@ inputMethodEngine.getInputMethodAbility().off('setCallingWindow', () => {
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
订阅输入法事件。
参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅输入法事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -507,7 +507,7 @@ inputMethodEngine.getInputMethodAbility().on('keyboardHide', () => {
...
@@ -507,7 +507,7 @@ inputMethodEngine.getInputMethodAbility().on('keyboardHide', () => {
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
取消订阅输入法事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅输入法事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -533,7 +533,7 @@ inputMethodEngine.getInputMethodAbility().off('keyboardHide', () => {
...
@@ -533,7 +533,7 @@ inputMethodEngine.getInputMethodAbility().off('keyboardHide', () => {
on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void
on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void
订阅设置输入法子类型事件。
参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅设置输入法子类型事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -542,7 +542,7 @@ on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => voi
...
@@ -542,7 +542,7 @@ on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => voi
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'setSubtype',表示订阅输入法子类型设置。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'setSubtype',表示订阅输入法子类型设置。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | InputMethodSubtype | 是 | 调用方的输入法子类型。 |
| callback | InputMethodSubtype | 是 |
回调函数,,返回
调用方的输入法子类型。 |
**示例:**
**示例:**
...
@@ -556,7 +556,7 @@ inputMethodEngine.getInputMethodAbility().on('setSubtype', (inputMethodSubtype)
...
@@ -556,7 +556,7 @@ inputMethodEngine.getInputMethodAbility().on('setSubtype', (inputMethodSubtype)
off(type: 'setSubtype', callback?: () => void): void
off(type: 'setSubtype', callback?: () => void): void
取消订阅输入法子类型事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅输入法子类型事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -565,7 +565,7 @@ off(type: 'setSubtype', callback?: () => void): void
...
@@ -565,7 +565,7 @@ off(type: 'setSubtype', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'setSubtype',表示取消订阅输入法子类型设置。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'setSubtype',表示取消订阅输入法子类型设置。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | InputMethodSubtype | 是 | 调用方的输入法子类型。 |
| callback | InputMethodSubtype | 是 |
回调函数,,返回
调用方的输入法子类型。 |
**示例:**
**示例:**
...
@@ -583,7 +583,7 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => {
...
@@ -583,7 +583,7 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => {
on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
订阅硬键盘事件
,使用callback回调返回按键信息。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅硬键盘事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -592,7 +592,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
...
@@ -592,7 +592,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyDown',表示订阅硬键盘按下。
<br/>
-
type为'keyUp',表示订阅硬键盘抬起。 |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyDown',表示订阅硬键盘按下。
<br/>
-
type为'keyUp',表示订阅硬键盘抬起。 |
| callback |
[
KeyEvent
](
#keyevent
)
| 是 | 回调返回按键信息。 |
| callback |
[
KeyEvent
](
#keyevent
)
| 是 | 回调
函数,
返回按键信息。 |
**示例:**
**示例:**
...
@@ -613,7 +613,7 @@ inputMethodEngine.getKeyboardDelegate().on('keyDown', (keyEvent) => {
...
@@ -613,7 +613,7 @@ inputMethodEngine.getKeyboardDelegate().on('keyDown', (keyEvent) => {
off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
取消订阅硬键盘事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅硬键盘事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -622,7 +622,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
...
@@ -622,7 +622,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyDown',表示订阅硬键盘按下。
<br/>
-
type为'keyUp',表示订阅硬键盘抬起。 |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyDown',表示订阅硬键盘按下。
<br/>
-
type为'keyUp',表示订阅硬键盘抬起。 |
| callback |
[
KeyEvent
](
#keyevent
)
| 否 | 回调返回按键信息。 |
| callback |
[
KeyEvent
](
#keyevent
)
| 否 | 回调
函数,
返回按键信息。 |
**示例:**
**示例:**
...
@@ -641,7 +641,7 @@ inputMethodEngine.getKeyboardDelegate().off('keyDown', (keyEvent) => {
...
@@ -641,7 +641,7 @@ inputMethodEngine.getKeyboardDelegate().off('keyDown', (keyEvent) => {
on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) => void): void
on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) => void): void
订阅光标变化事件
,使用callback回调返回光标信息。使用callback回调返回光标信息。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅光标变化事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -650,7 +650,7 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
...
@@ -650,7 +650,7 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 光标变化事件。
<br/>
-type为’cursorContextChange‘时,表示光标变化。 |
| type | string | 是 | 光标变化事件。
<br/>
-type为’cursorContextChange‘时,表示光标变化。 |
| callback | number | 是 | 回调返回光标信息。 |
| callback | number | 是 | 回调
函数,
返回光标信息。 |
...
@@ -668,7 +668,7 @@ inputMethodEngine.getKeyboardDelegate().on('cursorContextChange', (x, y, height)
...
@@ -668,7 +668,7 @@ inputMethodEngine.getKeyboardDelegate().on('cursorContextChange', (x, y, height)
off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number) => void): void
off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number) => void): void
取消订阅光标变化事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅光标变化事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -677,7 +677,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
...
@@ -677,7 +677,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 光标变化事件。
<br/>
-type为’cursorContextChange‘时,表示光标变化。 |
| type | string | 是 | 光标变化事件。
<br/>
-type为’cursorContextChange‘时,表示光标变化。 |
| callback | number | 否 | 回调返回光标信息。 |
| callback | number | 否 | 回调
函数,
返回光标信息。 |
**示例:**
**示例:**
...
@@ -691,7 +691,7 @@ inputMethodEngine.getKeyboardDelegate().off('cursorContextChange', (x, y, height
...
@@ -691,7 +691,7 @@ inputMethodEngine.getKeyboardDelegate().off('cursorContextChange', (x, y, height
on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void
on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void
订阅文本选择变化事件
,使用callback回调返回文本选择信息。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅文本选择变化事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -700,7 +700,7 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
...
@@ -700,7 +700,7 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本选择变化事件。
<br/>
-type为’selectionChange‘时,表示选择文本变化。 |
| type | string | 是 | 文本选择变化事件。
<br/>
-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 是 | 回调返回文本选择信息。 |
| callback | number | 是 | 回调
函数,
返回文本选择信息。 |
**示例:**
**示例:**
...
@@ -717,7 +717,7 @@ inputMethodEngine.getKeyboardDelegate().on('selectionChange', (oldBegin, oldEnd,
...
@@ -717,7 +717,7 @@ inputMethodEngine.getKeyboardDelegate().on('selectionChange', (oldBegin, oldEnd,
off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void
off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void
取消订阅文本选择变化事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅文本选择变化事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -726,7 +726,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
...
@@ -726,7 +726,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本选择变化事件。
<br/>
-type为’selectionChange‘时,表示选择文本变化。 |
| type | string | 是 | 文本选择变化事件。
<br/>
-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 否 | 回调返回文本选择信息。 |
| callback | number | 否 | 回调
函数,
返回文本选择信息。 |
**示例:**
**示例:**
...
@@ -741,7 +741,7 @@ inputMethodEngine.getKeyboardDelegate().off('selectionChange', (oldBegin, oldEnd
...
@@ -741,7 +741,7 @@ inputMethodEngine.getKeyboardDelegate().off('selectionChange', (oldBegin, oldEnd
on(type: 'textChange', callback: (text: string) => void): void
on(type: 'textChange', callback: (text: string) => void): void
订阅文本变化事件
,使用callback回调返回当前文本内容。参数个数为2,参数1为napi_string,参数2为napi_function,否则抛出异常
。
订阅文本变化事件
。使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -750,7 +750,7 @@ on(type: 'textChange', callback: (text: string) => void): void
...
@@ -750,7 +750,7 @@ on(type: 'textChange', callback: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。
<br/>
-type为’textChange‘时,表示当前文本变化。 |
| type | string | 是 | 文本变化事件。
<br/>
-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 是 | 回调返回当前文本内容。 |
| callback | string | 是 | 回调
函数,
返回当前文本内容。 |
**示例:**
**示例:**
...
@@ -764,7 +764,7 @@ inputMethodEngine.getKeyboardDelegate().on('textChange', (text) => {
...
@@ -764,7 +764,7 @@ inputMethodEngine.getKeyboardDelegate().on('textChange', (text) => {
off(type: 'textChange', callback?: (text: string) => void): void
off(type: 'textChange', callback?: (text: string) => void): void
取消订阅文本变化事件。
参数个数不为1或2抛出异常。若为1,参数不为napi_string抛出异常;若为2,参数1不为napi_string,参数2不为napi_function抛出异常。参数若为1,取消此类型所有监听;参数若为2,取消此类型当前监听
。
取消订阅文本变化事件。
使用callback异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -773,7 +773,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
...
@@ -773,7 +773,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。
<br/>
-type为’textChange‘时,表示当前文本变化。 |
| type | string | 是 | 文本变化事件。
<br/>
-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 否 | 回调返回当前文本内容。 |
| callback | string | 否 | 回调
函数,
返回当前文本内容。 |
**示例:**
**示例:**
...
@@ -791,7 +791,7 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => {
...
@@ -791,7 +791,7 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => {
hideKeyboard(callback: AsyncCallback
<
void
>
): void
hideKeyboard(callback: AsyncCallback
<
void
>
): void
隐藏输入法。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
隐藏输入法。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -799,17 +799,17 @@ hideKeyboard(callback: AsyncCallback<void>): void
...
@@ -799,17 +799,17 @@ hideKeyboard(callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------- |
| -------- | ---------------------- | ---- | -------- |
| callback | AsyncCallback
<
void> | 否 | 回调函数 |
| callback | AsyncCallback
<
void> | 否 | 回调函数
。当输入法隐藏成功,err为undefined,否则为错误对象
|
**示例:**
**示例:**
```
js
```
js
KeyboardController
.
hideKeyboard
((
err
)
=>
{
KeyboardController
.
hideKeyboard
((
err
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
hideKeyboard
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
hideKeyboard err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
hideKeyboard
callback
.
'
);
console
.
log
(
'
hideKeyboard
success
.
'
);
});
});
```
```
...
@@ -817,7 +817,7 @@ KeyboardController.hideKeyboard((err) => {
...
@@ -817,7 +817,7 @@ KeyboardController.hideKeyboard((err) => {
hideKeyboard(): Promise
<
void
>
hideKeyboard(): Promise
<
void
>
隐藏输入法。使用p
eomise形式返回结果。参数个数为0,否则抛出异常
。
隐藏输入法。使用p
romise异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -825,21 +825,20 @@ hideKeyboard(): Promise<void>
...
@@ -825,21 +825,20 @@ hideKeyboard(): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| ---------------- | ------------------------- |
| ---------------- | ------------------------- |
| Promise
<
void> | 无返回结果的Promise对象。 |
| Promise
<
void> |
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
```
js
```
js
async
function
InputMethodEngine
()
{
async
function
InputMethodEngine
()
{
await
KeyboardController
.
hideKeyboard
().
then
(()
=>
{
await
KeyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
'
hideKeyboard
promise
.
'
);
console
.
info
(
'
hideKeyboard
success
.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
hideKeyboard
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
hideKeyboard err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
## InputClient<a name="InputClient "></a><sup>9+</sup>
## InputClient<a name="InputClient "></a><sup>9+</sup>
下列API示例中都需使用
[
inputStart
](
#inputStart9
)
回调获取到InputClient实例,再通过此实例调用对应方法。
下列API示例中都需使用
[
inputStart
](
#inputStart9
)
回调获取到InputClient实例,再通过此实例调用对应方法。
...
@@ -848,7 +847,7 @@ async function InputMethodEngine() {
...
@@ -848,7 +847,7 @@ async function InputMethodEngine() {
sendKeyFunction(action:number, callback: AsyncCallback
<
boolean
>
): void
sendKeyFunction(action:number, callback: AsyncCallback
<
boolean
>
): void
发送功能键。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
发送功能键。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -857,7 +856,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
...
@@ -857,7 +856,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| action | number | 是 | 编辑框属性。 |
| action | number | 是 | 编辑框属性。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当功能键发送成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -869,9 +868,9 @@ try {
...
@@ -869,9 +868,9 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to sendKeyFunction.
(callback)
'
);
console
.
info
(
'
Success to sendKeyFunction.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
(callback)
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -883,7 +882,7 @@ try {
...
@@ -883,7 +882,7 @@ try {
sendKeyFunction(action:number): Promise
<
boolean
>
sendKeyFunction(action:number): Promise
<
boolean
>
发送功能键。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
发送功能键。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -897,7 +896,7 @@ sendKeyFunction(action:number): Promise<boolean>
...
@@ -897,7 +896,7 @@ sendKeyFunction(action:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示功能键发送成功;返回false表示功能键发送失败。
|
**示例:**
**示例:**
...
@@ -905,12 +904,12 @@ sendKeyFunction(action:number): Promise<boolean>
...
@@ -905,12 +904,12 @@ sendKeyFunction(action:number): Promise<boolean>
try
{
try
{
InputClient
.
sendKeyFunction
(
keyFunction
).
then
((
result
)
=>
{
InputClient
.
sendKeyFunction
(
keyFunction
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to sendKeyFunction.
(callback)
'
);
console
.
info
(
'
Success to sendKeyFunction.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
(callback)
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
sendKeyFunction
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
));
...
@@ -921,7 +920,7 @@ try {
...
@@ -921,7 +920,7 @@ try {
getForward(length:number, callback: AsyncCallback
<
string
>
): void
getForward(length:number, callback: AsyncCallback
<
string
>
): void
获取光标前固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取光标前固定长度的文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -930,7 +929,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
...
@@ -930,7 +929,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 |
返回文本
。 |
| callback | AsyncCallback
<
string
>
| 是 |
回调函数。当光标前固定长度的文本获取成功,err为undefined,data为获取到的文本;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -942,7 +941,7 @@ try {
...
@@ -942,7 +941,7 @@ try {
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
getForward
callback
result:
'
+
text
);
console
.
log
(
'
getForward result:
'
+
text
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
...
@@ -953,7 +952,7 @@ try {
...
@@ -953,7 +952,7 @@ try {
getForward(length:number): Promise
<
string
>
getForward(length:number): Promise
<
string
>
获取光标前固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
获取光标前固定长度的文本。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -967,7 +966,7 @@ getForward(length:number): Promise<string>
...
@@ -967,7 +966,7 @@ getForward(length:number): Promise<string>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
| 返回文本。
|
| Promise
<
string
>
| Promise对象,返回光标前固定长度的文本。
|
**示例:**
**示例:**
...
@@ -976,12 +975,12 @@ async function InputMethodAbility() {
...
@@ -976,12 +975,12 @@ async function InputMethodAbility() {
let
length
=
1
;
let
length
=
1
;
try
{
try
{
await
InputClient
.
getForward
(
length
).
then
((
text
)
=>
{
await
InputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
getForward
promise
resul:
'
+
text
);
console
.
info
(
'
getForward resul:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
getForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
}
}
}
}
```
```
...
@@ -990,7 +989,7 @@ async function InputMethodAbility() {
...
@@ -990,7 +989,7 @@ async function InputMethodAbility() {
getBackward(length:number, callback: AsyncCallback
<
string
>
): void
getBackward(length:number, callback: AsyncCallback
<
string
>
): void
获取光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取光标后固定长度的文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -999,7 +998,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
...
@@ -999,7 +998,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 |
返回文本。
|
| callback | AsyncCallback
<
string
>
| 是 |
回调函数。当光标后固定长度的文本获取成功,err为undefined,data为获取到的文本;否则为错误对象。
|
**示例:**
**示例:**
...
@@ -1008,13 +1007,13 @@ let length = 1;
...
@@ -1008,13 +1007,13 @@ let length = 1;
try
{
try
{
InputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
InputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
getBackward
callback
result:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward result:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
getBackward
callback
result---text:
'
+
text
);
console
.
log
(
'
getBackward result---text:
'
+
text
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
getBackward
callback
result:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward result:
'
+
JSON
.
stringify
(
err
));
}
}
```
```
...
@@ -1022,7 +1021,7 @@ try {
...
@@ -1022,7 +1021,7 @@ try {
getBackward(length:number): Promise
<
string
>
getBackward(length:number): Promise
<
string
>
获取光标后固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
获取光标后固定长度的文本。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1036,7 +1035,7 @@ getBackward(length:number): Promise<string>
...
@@ -1036,7 +1035,7 @@ getBackward(length:number): Promise<string>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
| 返回文本。
|
| Promise
<
string
>
| Promise对象,返回光标后固定长度的文本。
|
**示例:**
**示例:**
...
@@ -1045,12 +1044,12 @@ async function InputMethodAbility() {
...
@@ -1045,12 +1044,12 @@ async function InputMethodAbility() {
let
length
=
1
;
let
length
=
1
;
try
{
try
{
await
InputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
await
InputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
getBackward
promise
result:
'
+
text
);
console
.
info
(
'
getBackward result:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getBackward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
getBackward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward err:
'
+
JSON
.
stringify
(
err
));
}
}
}
}
```
```
...
@@ -1059,7 +1058,7 @@ async function InputMethodAbility() {
...
@@ -1059,7 +1058,7 @@ async function InputMethodAbility() {
deleteForward(length:number, callback: AsyncCallback
<
boolean
>
): void
deleteForward(length:number, callback: AsyncCallback
<
boolean
>
): void
删除光标前固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标前固定长度的文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1068,7 +1067,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1068,7 +1067,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当光标前固定长度的文本删除成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -1077,17 +1076,17 @@ let length = 1;
...
@@ -1077,17 +1076,17 @@ let length = 1;
try
{
try
{
InputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
InputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
deleteForward
callback
result:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward result:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteForward.
(callback)
'
);
console
.
info
(
'
Success to deleteForward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteForward.
(callback)
'
);
console
.
error
(
'
Failed to deleteForward.
'
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
deleteForward
callback
result:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward result:
'
+
JSON
.
stringify
(
err
));
}
}
```
```
...
@@ -1095,7 +1094,7 @@ try {
...
@@ -1095,7 +1094,7 @@ try {
deleteForward(length:number): Promise
<
boolean
>
deleteForward(length:number): Promise
<
boolean
>
删除光标前固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
删除光标前固定长度的文本。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1109,7 +1108,7 @@ deleteForward(length:number): Promise<boolean>
...
@@ -1109,7 +1108,7 @@ deleteForward(length:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ---------------------- | -------------- |
| ---------------------- | -------------- |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示删除光标前固定长度的文本成功;返回false表示删除光标前固定长度的文本失败。
|
**示例:**
**示例:**
...
@@ -1119,15 +1118,15 @@ async function InputMethodAbility() {
...
@@ -1119,15 +1118,15 @@ async function InputMethodAbility() {
try
{
try
{
await
InputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
await
InputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteForward.
(promise)
'
);
console
.
info
(
'
Success to deleteForward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteForward.
(promise)
'
);
console
.
error
(
'
Failed to deleteForward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
deleteForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
deleteForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward err:
'
+
JSON
.
stringify
(
err
));
}
}
}
}
```
```
...
@@ -1136,7 +1135,7 @@ async function InputMethodAbility() {
...
@@ -1136,7 +1135,7 @@ async function InputMethodAbility() {
deleteBackward(length:number, callback: AsyncCallback
<
boolean
>
): void
deleteBackward(length:number, callback: AsyncCallback
<
boolean
>
): void
删除光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标后固定长度的文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1145,7 +1144,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1145,7 +1144,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------- |
| -------- | ---------------------------- | ---- | -------------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当光标后固定长度的文本删除成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -1158,9 +1157,9 @@ try {
...
@@ -1158,9 +1157,9 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteBackward.
(callback)
'
);
console
.
info
(
'
Success to deleteBackward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
(callback)
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -1172,7 +1171,7 @@ try {
...
@@ -1172,7 +1171,7 @@ try {
deleteBackward(length:number): Promise
<
boolean
>
deleteBackward(length:number): Promise
<
boolean
>
删除光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标后固定长度的文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1186,7 +1185,7 @@ deleteBackward(length:number): Promise<boolean>
...
@@ -1186,7 +1185,7 @@ deleteBackward(length:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示删除光标后固定长度的文本成功;返回false表示删除光标后固定长度的文本失败。
|
**示例:**
**示例:**
...
@@ -1195,12 +1194,12 @@ async function InputMethodAbility() {
...
@@ -1195,12 +1194,12 @@ async function InputMethodAbility() {
let
length
=
1
;
let
length
=
1
;
await
InputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
await
InputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteBackward.
(promise)
'
);
console
.
info
(
'
Success to deleteBackward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
(promise)
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
deleteBackward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteBackward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1209,7 +1208,7 @@ async function InputMethodAbility() {
...
@@ -1209,7 +1208,7 @@ async function InputMethodAbility() {
insertText(text:string, callback: AsyncCallback
<
boolean
>
): void
insertText(text:string, callback: AsyncCallback
<
boolean
>
): void
插入文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
插入文本。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1218,7 +1217,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
...
@@ -1218,7 +1217,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 文本。 |
| text | string | 是 | 文本。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当文本插入成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -1229,9 +1228,9 @@ InputClient.insertText('test', (err, result) => {
...
@@ -1229,9 +1228,9 @@ InputClient.insertText('test', (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to insertText.
(callback)
'
);
console
.
info
(
'
Success to insertText.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
(callback)
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
});
});
```
```
...
@@ -1240,7 +1239,7 @@ InputClient.insertText('test', (err, result) => {
...
@@ -1240,7 +1239,7 @@ InputClient.insertText('test', (err, result) => {
insertText(text:string): Promise
<
boolean
>
insertText(text:string): Promise
<
boolean
>
插入文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
插入文本。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1254,7 +1253,7 @@ insertText(text:string): Promise<boolean>
...
@@ -1254,7 +1253,7 @@ insertText(text:string): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
| 操作成功与否。
|
| Promise
<
boolean
>
| Promise对象。返回true表示插入文本成功;返回false表示插入文本失败。
|
**示例:**
**示例:**
...
@@ -1263,15 +1262,15 @@ async function InputMethodAbility() {
...
@@ -1263,15 +1262,15 @@ async function InputMethodAbility() {
try
{
try
{
await
InputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
await
InputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to insertText.
(promise)
'
);
console
.
info
(
'
Success to insertText.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
(promise)
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
insertText
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
insertText err:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
'
insertText
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
insertText err:
'
+
JSON
.
stringify
(
err
));
}
}
}
}
```
```
...
@@ -1280,7 +1279,7 @@ async function InputMethodAbility() {
...
@@ -1280,7 +1279,7 @@ async function InputMethodAbility() {
getEditorAttribute(callback: AsyncCallback
<
EditorAttribute
>
): void
getEditorAttribute(callback: AsyncCallback
<
EditorAttribute
>
): void
获取编辑框属性值。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
获取编辑框属性值。使用callback
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1288,18 +1287,18 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
...
@@ -1288,18 +1287,18 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| callback | AsyncCallback
<
[EditorAttribute](#EditorAttribute)
>
| 是 |
编辑框属性值。
|
| callback | AsyncCallback
<
[EditorAttribute](#EditorAttribute)
>
| 是 |
回调函数。当编辑框属性值获取成功,err为undefined,data为编辑框属性值;否则为错误对象。
|
**示例:**
**示例:**
```
js
```
js
InputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
InputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
getEditorAttribute
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getEditorAttribute err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
editorAttribute.inputPattern
(callback)
:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.enterKeyType
(callback)
:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
log
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
});
});
```
```
...
@@ -1307,7 +1306,7 @@ InputClient.getEditorAttribute((err, editorAttribute) => {
...
@@ -1307,7 +1306,7 @@ InputClient.getEditorAttribute((err, editorAttribute) => {
getEditorAttribute(): Promise
<
EditorAttribute
>
getEditorAttribute(): Promise
<
EditorAttribute
>
获取编辑框属性值。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
获取编辑框属性值。使用promise
异步回调
。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
...
@@ -1315,17 +1314,17 @@ getEditorAttribute(): Promise<EditorAttribute>
...
@@ -1315,17 +1314,17 @@ getEditorAttribute(): Promise<EditorAttribute>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
[EditorAttribute](#editorattribute)
>
| 返回编辑框属性值。 |
| Promise
<
[EditorAttribute](#editorattribute)
>
|
Promise对象,
返回编辑框属性值。 |
**示例:**
**示例:**
```
js
```
js
async
function
InputMethodEngine
()
{
async
function
InputMethodEngine
()
{
await
InputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
await
InputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
'
editorAttribute.inputPattern
(promise)
:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType
(promise)
:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getEditorAttribute
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getEditorAttribute err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1334,7 +1333,7 @@ async function InputMethodEngine() {
...
@@ -1334,7 +1333,7 @@ async function InputMethodEngine() {
moveCursor(direction: number, callback: AsyncCallback
<
void
>
): void
moveCursor(direction: number, callback: AsyncCallback
<
void
>
): void
移动光标。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
移动光标。使用callback
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -1345,11 +1344,11 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
...
@@ -1345,11 +1344,11 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | -------------- |
| --------- | ------------------------- | ---- | -------------- |
| direction | number | 是 | 光标移动方向。 |
| direction | number | 是 | 光标移动方向。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
|
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。
当光标移动成功,err为undefined,否则为错误对象
|
**示例:**
**示例:**
```
j
s
```
t
s
try
{
try
{
InputClient
.
moveCursor
(
inputMethodAbility
.
CURSOR_xxx
,
(
err
)
=>
{
InputClient
.
moveCursor
(
inputMethodAbility
.
CURSOR_xxx
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
...
@@ -1367,7 +1366,7 @@ try {
...
@@ -1367,7 +1366,7 @@ try {
moveCursor(direction: number): Promise
<
void
>
moveCursor(direction: number): Promise
<
void
>
移动光标。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
移动光标。使用promise
异步回调
。
**模型约束**
: 此接口仅可在Stage模型下使用。
**模型约束**
: 此接口仅可在Stage模型下使用。
...
@@ -1383,11 +1382,11 @@ moveCursor(direction: number): Promise<void>
...
@@ -1383,11 +1382,11 @@ moveCursor(direction: number): Promise<void>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------- | ------------------------- |
| ------------------- | ------------------------- |
| Promise
<
void
>
| 无返回结果的Promise对象。 |
| Promise
<
void
>
|
Promise对象。
无返回结果的Promise对象。 |
**示例:**
**示例:**
```
j
s
```
t
s
async
function
InputMethodAbility
()
{
async
function
InputMethodAbility
()
{
try
{
try
{
await
InputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_xxx
).
then
((
err
)
=>
{
await
InputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_xxx
).
then
((
err
)
=>
{
...
@@ -1435,7 +1434,7 @@ async function InputMethodAbility() {
...
@@ -1435,7 +1434,7 @@ async function InputMethodAbility() {
getForward(length:number, callback: AsyncCallback
<
string
>
): void
getForward(length:number, callback: AsyncCallback
<
string
>
): void
获取光标前固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取光标前固定长度的文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代
...
@@ -1447,7 +1446,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
...
@@ -1447,7 +1446,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 |
返回文本。
|
| callback | AsyncCallback
<
string
>
| 是 |
回调函数。当光标前固定长度的文本获取成功,err为undefined,data为获取到的文本;否则为错误对象。
|
**示例:**
**示例:**
...
@@ -1455,10 +1454,10 @@ getForward(length:number, callback: AsyncCallback<string>): void
...
@@ -1455,10 +1454,10 @@ getForward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
let
length
=
1
;
TextInputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
TextInputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
getForward
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
getForward
callback
result---text:
'
+
text
);
console
.
log
(
'
getForward result---text:
'
+
text
);
});
});
```
```
...
@@ -1466,7 +1465,7 @@ TextInputClient.getForward(length, (err, text) => {
...
@@ -1466,7 +1465,7 @@ TextInputClient.getForward(length, (err, text) => {
getForward(length:number): Promise
<
string
>
getForward(length:number): Promise
<
string
>
获取光标前固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
获取光标前固定长度的文本。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代
...
@@ -1483,7 +1482,7 @@ getForward(length:number): Promise<string>
...
@@ -1483,7 +1482,7 @@ getForward(length:number): Promise<string>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
|
返回
文本。 |
| Promise
<
string
>
|
Promise对象,返回光标前固定长度的
文本。 |
**示例:**
**示例:**
...
@@ -1491,9 +1490,9 @@ getForward(length:number): Promise<string>
...
@@ -1491,9 +1490,9 @@ getForward(length:number): Promise<string>
async
function
InputMethodEngine
()
{
async
function
InputMethodEngine
()
{
let
length
=
1
;
let
length
=
1
;
await
TextInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
await
TextInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
getForward
promise
result---res:
'
+
text
);
console
.
info
(
'
getForward result---res:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getForward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1502,7 +1501,7 @@ async function InputMethodEngine() {
...
@@ -1502,7 +1501,7 @@ async function InputMethodEngine() {
getBackward(length:number, callback: AsyncCallback
<
string
>
): void
getBackward(length:number, callback: AsyncCallback
<
string
>
): void
获取光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
获取光标后固定长度的文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
...
@@ -1514,7 +1513,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
...
@@ -1514,7 +1513,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 |
返回文本
。 |
| callback | AsyncCallback
<
string
>
| 是 |
回调函数。当光标后固定长度的文本获取成功,err为undefined,data为获取到的文本;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -1522,10 +1521,10 @@ getBackward(length:number, callback: AsyncCallback<string>): void
...
@@ -1522,10 +1521,10 @@ getBackward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
let
length
=
1
;
TextInputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
TextInputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
getBackward
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
getBackward
callback
result---text:
'
+
text
);
console
.
log
(
'
getBackward result---text:
'
+
text
);
});
});
```
```
...
@@ -1533,7 +1532,7 @@ TextInputClient.getBackward(length, (err, text) => {
...
@@ -1533,7 +1532,7 @@ TextInputClient.getBackward(length, (err, text) => {
getBackward(length:number): Promise
<
string
>
getBackward(length:number): Promise
<
string
>
获取光标后固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
获取光标后固定长度的文本。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代
...
@@ -1550,7 +1549,7 @@ getBackward(length:number): Promise<string>
...
@@ -1550,7 +1549,7 @@ getBackward(length:number): Promise<string>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
|
返回
文本。 |
| Promise
<
string
>
|
Promise对象,返回光标后固定长度的
文本。 |
**示例:**
**示例:**
...
@@ -1558,9 +1557,9 @@ getBackward(length:number): Promise<string>
...
@@ -1558,9 +1557,9 @@ getBackward(length:number): Promise<string>
async
function
InputMethodEngine
()
{
async
function
InputMethodEngine
()
{
let
length
=
1
;
let
length
=
1
;
await
TextInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
await
TextInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
getBackward
promise
result---res:
'
+
text
);
console
.
info
(
'
getBackward result---res:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getBackward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getBackward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1569,7 +1568,7 @@ async function InputMethodEngine() {
...
@@ -1569,7 +1568,7 @@ async function InputMethodEngine() {
deleteForward(length:number, callback: AsyncCallback
<
boolean
>
): void
deleteForward(length:number, callback: AsyncCallback
<
boolean
>
): void
删除光标前固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标前固定长度的文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
...
@@ -1581,7 +1580,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1581,7 +1580,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当光标前固定长度的文本删除成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
...
@@ -1589,13 +1588,13 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1589,13 +1588,13 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
let
length
=
1
;
TextInputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
TextInputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
deleteForward
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteForward.
(callback)
'
);
console
.
info
(
'
Success to deleteForward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteForward.
(callback)
'
);
console
.
error
(
'
Failed to deleteForward.
'
);
}
}
});
});
```
```
...
@@ -1604,7 +1603,7 @@ TextInputClient.deleteForward(length, (err, result) => {
...
@@ -1604,7 +1603,7 @@ TextInputClient.deleteForward(length, (err, result) => {
deleteForward(length:number): Promise
<
boolean
>
deleteForward(length:number): Promise
<
boolean
>
删除光标前固定长度的文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
删除光标前固定长度的文本。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代
...
@@ -1621,7 +1620,7 @@ deleteForward(length:number): Promise<boolean>
...
@@ -1621,7 +1620,7 @@ deleteForward(length:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ---------------------- | -------------- |
| ---------------------- | -------------- |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示删除光标前固定长度的文本成功;返回false表示删除光标前固定长度的文本失败。
|
**示例:**
**示例:**
...
@@ -1630,12 +1629,12 @@ async function InputMethodEngine() {
...
@@ -1630,12 +1629,12 @@ async function InputMethodEngine() {
let
length
=
1
;
let
length
=
1
;
await
TextInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
await
TextInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteForward.
(promise)
'
);
console
.
info
(
'
Success to deleteForward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteForward.
(promise)
'
);
console
.
error
(
'
Failed to deleteForward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
deleteForward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteForward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1644,7 +1643,7 @@ async function InputMethodEngine() {
...
@@ -1644,7 +1643,7 @@ async function InputMethodEngine() {
deleteBackward(length:number, callback: AsyncCallback
<
boolean
>
): void
deleteBackward(length:number, callback: AsyncCallback
<
boolean
>
): void
删除光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标后固定长度的文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
...
@@ -1656,7 +1655,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1656,7 +1655,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------- |
| -------- | ---------------------------- | ---- | -------------- |
| length | number | 是 | 文本长度。 |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否。
|
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当光标后固定长度的文本删除成功,err为undefined,data为true;否则为错误对象。
|
**示例:**
**示例:**
...
@@ -1664,13 +1663,13 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
...
@@ -1664,13 +1663,13 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
let
length
=
1
;
TextInputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
TextInputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
deleteBackward
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteBackward err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteBackward.
(callback)
'
);
console
.
info
(
'
Success to deleteBackward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
(callback)
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
});
});
```
```
...
@@ -1679,7 +1678,7 @@ TextInputClient.deleteBackward(length, (err, result) => {
...
@@ -1679,7 +1678,7 @@ TextInputClient.deleteBackward(length, (err, result) => {
deleteBackward(length:number): Promise
<
boolean
>
deleteBackward(length:number): Promise
<
boolean
>
删除光标后固定长度的文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
删除光标后固定长度的文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代
...
@@ -1696,7 +1695,7 @@ deleteBackward(length:number): Promise<boolean>
...
@@ -1696,7 +1695,7 @@ deleteBackward(length:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示删除光标后固定长度的文本成功;返回false表示删除光标后固定长度的文本失败。
|
**示例:**
**示例:**
...
@@ -1705,12 +1704,12 @@ async function InputMethodEngine() {
...
@@ -1705,12 +1704,12 @@ async function InputMethodEngine() {
let
length
=
1
;
let
length
=
1
;
await
TextInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
await
TextInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to deleteBackward.
(promise)
'
);
console
.
info
(
'
Success to deleteBackward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
(promise)
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
deleteBackward
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
deleteBackward err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1718,7 +1717,7 @@ async function InputMethodEngine() {
...
@@ -1718,7 +1717,7 @@ async function InputMethodEngine() {
sendKeyFunction(action:number, callback: AsyncCallback
<
boolean
>
): void
sendKeyFunction(action:number, callback: AsyncCallback
<
boolean
>
): void
发送功能键。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
发送功能键。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
...
@@ -1730,20 +1729,20 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
...
@@ -1730,20 +1729,20 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| action | number | 是 | 编辑框属性。 |
| action | number | 是 | 编辑框属性。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当功能键发送成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
```
js
```
js
TextInputClient
.
sendKeyFunction
(
keyFunction
,
(
err
,
result
)
=>
{
TextInputClient
.
sendKeyFunction
(
keyFunction
,
(
err
,
result
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
sendKeyFunction
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to sendKeyFunction.
(callback)
'
);
console
.
info
(
'
Success to sendKeyFunction.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
(callback)
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
});
});
```
```
...
@@ -1752,7 +1751,7 @@ TextInputClient.sendKeyFunction(keyFunction, (err, result) => {
...
@@ -1752,7 +1751,7 @@ TextInputClient.sendKeyFunction(keyFunction, (err, result) => {
sendKeyFunction(action:number): Promise
<
boolean
>
sendKeyFunction(action:number): Promise
<
boolean
>
发送功能键。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
发送功能键。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代
...
@@ -1769,7 +1768,7 @@ sendKeyFunction(action:number): Promise<boolean>
...
@@ -1769,7 +1768,7 @@ sendKeyFunction(action:number): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示发送功能键成功;返回false表示发送功能键失败。
|
**示例:**
**示例:**
...
@@ -1777,12 +1776,12 @@ sendKeyFunction(action:number): Promise<boolean>
...
@@ -1777,12 +1776,12 @@ sendKeyFunction(action:number): Promise<boolean>
async
function
InputMethodEngine
()
{
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.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
(promise)
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
sendKeyFunction
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1791,7 +1790,7 @@ async function InputMethodEngine() {
...
@@ -1791,7 +1790,7 @@ async function InputMethodEngine() {
insertText(text:string, callback: AsyncCallback
<
boolean
>
): void
insertText(text:string, callback: AsyncCallback
<
boolean
>
): void
插入文本。使用callback
形式返回结果。参数个数为2,否则抛出异常
。
插入文本。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
...
@@ -1803,20 +1802,20 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
...
@@ -1803,20 +1802,20 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 文本。 |
| text | string | 是 | 文本。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
操作成功与否
。 |
| callback | AsyncCallback
<
boolean
>
| 是 |
回调函数。当文本插入成功,err为undefined,data为true;否则为错误对象
。 |
**示例:**
**示例:**
```
js
```
js
TextInputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
TextInputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
insertText
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
insertText err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Success to insertText.
(callback)
'
);
console
.
info
(
'
Success to insertText.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
(callback)
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
});
});
```
```
...
@@ -1825,7 +1824,7 @@ TextInputClient.insertText('test', (err, result) => {
...
@@ -1825,7 +1824,7 @@ TextInputClient.insertText('test', (err, result) => {
insertText(text:string): Promise
<
boolean
>
insertText(text:string): Promise
<
boolean
>
插入文本。使用promise
形式返回结果。参数个数为1,否则抛出异常
。
插入文本。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代
...
@@ -1842,7 +1841,7 @@ insertText(text:string): Promise<boolean>
...
@@ -1842,7 +1841,7 @@ insertText(text:string): Promise<boolean>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
|
操作成功与否。
|
| Promise
<
boolean
>
|
Promise对象。返回true表示插入文本成功;返回false表示插入文本失败。
|
**示例:**
**示例:**
...
@@ -1850,12 +1849,12 @@ insertText(text:string): Promise<boolean>
...
@@ -1850,12 +1849,12 @@ insertText(text:string): Promise<boolean>
async
function
InputMethodEngine
()
{
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.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
(promise)
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
insertText
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
insertText err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
...
@@ -1864,7 +1863,7 @@ async function InputMethodEngine() {
...
@@ -1864,7 +1863,7 @@ async function InputMethodEngine() {
getEditorAttribute(callback: AsyncCallback
<
EditorAttribute
>
): void
getEditorAttribute(callback: AsyncCallback
<
EditorAttribute
>
): void
获取编辑框属性值。使用callback
形式返回结果。参数个数为1,否则抛出异常
。
获取编辑框属性值。使用callback
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代
...
@@ -1875,18 +1874,18 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
...
@@ -1875,18 +1874,18 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| callback | AsyncCallback
<
[EditorAttribute](#editorattribute)
>
| 是 |
编辑框属性值。
|
| callback | AsyncCallback
<
[EditorAttribute](#editorattribute)
>
| 是 |
回调函数。当编辑框的属性值获取成功,err为undefined,data为编辑框属性值;否则为错误对象。
|
**示例:**
**示例:**
```
js
```
js
TextInputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
TextInputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
console
.
error
(
'
getEditorAttribute
callback result---
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getEditorAttribute err:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
log
(
'
editorAttribute.inputPattern
(callback)
:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.enterKeyType
(callback)
:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
log
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
});
});
```
```
...
@@ -1894,7 +1893,7 @@ TextInputClient.getEditorAttribute((err, editorAttribute) => {
...
@@ -1894,7 +1893,7 @@ TextInputClient.getEditorAttribute((err, editorAttribute) => {
getEditorAttribute(): Promise
<
EditorAttribute
>
getEditorAttribute(): Promise
<
EditorAttribute
>
获取编辑框属性值。使用promise
形式返回结果。参数个数为0,否则抛出异常
。
获取编辑框属性值。使用promise
异步回调
。
> **说明:**
> **说明:**
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代
...
@@ -1905,17 +1904,17 @@ getEditorAttribute(): Promise<EditorAttribute>
...
@@ -1905,17 +1904,17 @@ getEditorAttribute(): Promise<EditorAttribute>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
[EditorAttribute](#editorattribute)
>
| 返回编辑框属性值。 |
| Promise
<
[EditorAttribute](#editorattribute)
>
|
Promise对象,
返回编辑框属性值。 |
**示例:**
**示例:**
```
js
```
js
async
function
InputMethodEngine
()
{
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:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType
(promise)
:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getEditorAttribute
promise
err:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
getEditorAttribute err:
'
+
JSON
.
stringify
(
err
));
});
});
}
}
```
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录