Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
040b8e44
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
040b8e44
编写于
5月 07, 2023
作者:
H
Hollokin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
统一异常打印风格
Signed-off-by:
N
Hollokin
<
taoyuxin2@huawei.com
>
上级
72c88a41
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
182 addition
and
182 deletion
+182
-182
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+82
-82
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+100
-100
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
040b8e44
...
...
@@ -137,7 +137,7 @@ let prop = {
try
{
inputMethod
.
switchInputMethod
(
prop
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to switchInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -147,7 +147,7 @@ try{
}
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
}
```
## inputMethod.switchInputMethod<sup>9+</sup>
...
...
@@ -199,10 +199,10 @@ try {
console
.
error
(
'
Failed to switchInputMethod.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to switchInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -268,7 +268,7 @@ try {
extra
:
{}
},
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -278,7 +278,7 @@ try {
}
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -334,10 +334,10 @@ try {
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -396,7 +396,7 @@ let imSubType = inputMethod.getCurrentInputMethodSubtype();
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
im
,
imSubType
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -406,7 +406,7 @@ try {
}
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -455,10 +455,10 @@ try {
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -696,8 +696,8 @@ try {
}
console
.
info
(
'
Succeeded in attaching the inputMethod.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -748,8 +748,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
or
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -968,8 +968,8 @@ detach(): Promise<void>
```
js
inputMethodController
.
detach
().
then
(()
=>
{
console
.
info
(
'
Succeeded in detaching inputMethod.
'
);
}).
catch
((
err
or
)
=>
{
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
or
)}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1012,8 +1012,8 @@ try {
}
console
.
info
(
'
Succeeded in setting callingWindow.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1059,8 +1059,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
or
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1102,8 +1102,8 @@ try {
}
console
.
info
(
'
Succeeded in updating cursorInfo.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1148,8 +1148,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
or
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1191,8 +1191,8 @@ try {
}
console
.
info
(
'
Succeeded in changing selection.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1237,8 +1237,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
or
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1278,8 +1278,8 @@ try {
}
console
.
info
(
'
Succeeded in updating attribute.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1322,8 +1322,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
or
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1356,9 +1356,9 @@ stopInputSession(callback: AsyncCallback<boolean>): void
```
js
try
{
inputMethodController
.
stopInputSession
((
err
or
,
result
)
=>
{
if
(
err
or
)
{
console
.
error
(
'
Failed to stopInputSession:
'
+
JSON
.
stringify
(
error
)
);
inputMethodController
.
stopInputSession
((
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to stopInputSession:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -1367,8 +1367,8 @@ try {
console
.
error
(
'
Failed to stopInputSession.
'
);
}
});
}
catch
(
err
or
)
{
console
.
error
(
'
Failed to stopInputSession:
'
+
JSON
.
stringify
(
error
)
);
}
catch
(
err
)
{
console
.
error
(
`Failed to stopInputSession:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1408,10 +1408,10 @@ try {
console
.
error
(
'
Failed to stopInputSession.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to stopInputSession:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to stopInputSession:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to stopInputSession:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to stopInputSession:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1449,7 +1449,7 @@ inputMethodController.showSoftKeyboard((err) => {
if
(
!
err
)
{
console
.
info
(
'
Succeeded in showing softKeyboard.
'
);
}
else
{
console
.
error
(
'
Failed to showSoftKeyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to show softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
}
})
```
...
...
@@ -1487,7 +1487,7 @@ showSoftKeyboard(): Promise<void>
inputMethodController
.
showSoftKeyboard
().
then
(()
=>
{
console
.
log
(
'
Succeeded in showing softKeyboard.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to showSoftKeyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to show softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1525,7 +1525,7 @@ inputMethodController.hideSoftKeyboard((err) => {
if
(
!
err
)
{
console
.
info
(
'
Succeeded in hiding softKeyboard.
'
);
}
else
{
console
.
error
(
'
Failed to hideSoftKeyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hide softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
}
})
```
...
...
@@ -1563,7 +1563,7 @@ hideSoftKeyboard(): Promise<void>
inputMethodController
.
hideSoftKeyboard
().
then
(()
=>
{
console
.
log
(
'
Succeeded in hiding softKeyboard.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hideSoftKeyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hide softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1590,9 +1590,9 @@ stopInput(callback: AsyncCallback<boolean>): void
**示例:**
```
js
inputMethodController
.
stopInput
((
err
or
,
result
)
=>
{
if
(
err
or
)
{
console
.
error
(
'
Failed to stopInput:
'
+
JSON
.
stringify
(
error
)
);
inputMethodController
.
stopInput
((
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to stopInput:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -1633,7 +1633,7 @@ inputMethodController.stopInput().then((result) => {
console
.
error
(
'
Failed to stopInput.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to stopInput:
'
+
err
);
console
.
error
(
`Failed to stopInput:
${
JSON
.
stringify
(
err
)}
`
);
})
```
...
...
@@ -1667,8 +1667,8 @@ try {
inputMethodController
.
on
(
'
insertText
'
,
(
text
)
=>
{
console
.
info
(
`Succeeded in subscribing insertText:
${
text
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe insertText:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe insertText:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1722,16 +1722,16 @@ try {
inputMethodController
.
on
(
'
deleteLeft
'
,
(
length
)
=>
{
console
.
info
(
`Succeeded in subscribing deleteLeft, length:
${
length
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe deleteLeft:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe deleteLeft:
${
JSON
.
stringify
(
err
)}
`
);
}
try
{
inputMethodController
.
on
(
'
deleteRight
'
,
(
length
)
=>
{
console
.
info
(
`Succeeded in subscribing deleteRight, length:
${
length
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe deleteRight:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe deleteRight:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1786,8 +1786,8 @@ try {
inputMethodController
.
on
(
'
sendKeyboardStatus
'
,
(
keyBoardStatus
)
=>
{
console
.
info
(
`Succeeded in subscribing sendKeyboardStatus, keyBoardStatus:
${
keyBoardStatus
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe sendKeyboardStatus:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe sendKeyboardStatus:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1841,8 +1841,8 @@ try {
inputMethodController
.
on
(
'
sendFunctionKey
'
,
(
functionKey
)
=>
{
console
.
info
(
`Succeeded in subscribing sendFunctionKey, functionKey.enterKeyType:
${
functionKey
.
enterKeyType
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe sendFunctionKey:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe sendFunctionKey:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1896,8 +1896,8 @@ try {
inputMethodController
.
on
(
'
moveCursor
'
,
(
direction
)
=>
{
console
.
info
(
`Succeeded in subscribing moveCursor, direction:
${
direction
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe moveCursor:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1951,8 +1951,8 @@ try {
inputMethodController
.
on
(
'
handleExtendAction
'
,
(
action
)
=>
{
console
.
info
(
`Succeeded in subscribing handleExtendAction, action:
${
action
}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to subscribe handleExtendAction:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe handleExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2147,13 +2147,13 @@ let inputMethodProperty = {
try
{
inputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to listInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in listing inputMethodSubtype.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to listInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2200,10 +2200,10 @@ try {
inputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
).
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing inputMethodSubtype.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to listInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to listInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2236,13 +2236,13 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
try
{
inputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to listCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in listing currentInputMethodSubtype.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to listCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2276,10 +2276,10 @@ try {
inputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing currentInputMethodSubtype.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to listCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to listCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2313,13 +2313,13 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
try
{
inputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in getting inputMethods.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to getInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2359,10 +2359,10 @@ try {
inputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in getting inputMethods.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
})
}
catch
(
err
)
{
console
.
error
(
'
Failed to getInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2394,13 +2394,13 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void
try
{
inputMethodSetting
.
showOptionalInputMethods
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2432,7 +2432,7 @@ showOptionalInputMethods(): Promise<boolean>
inputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
})
```
...
...
@@ -2459,7 +2459,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
```
js
inputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to listInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in listing inputMethod.
'
);
...
...
@@ -2490,7 +2490,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
inputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing inputMethod.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to listInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to listInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
})
```
...
...
@@ -2517,7 +2517,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
```
js
inputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to displayOptionalInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in displaying optionalInputMethod.
'
);
...
...
@@ -2548,6 +2548,6 @@ displayOptionalInputMethod(): Promise<void>
inputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
'
Succeeded in displaying optionalInputMethod.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to displayOptionalInputMethod:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
})
```
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
040b8e44
...
...
@@ -514,13 +514,13 @@ let panelInfo: inputMethodEngine.PanelInfo = {
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to createPanel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeed in creating panel.
'
);
})
}
catch
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to createPanel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -562,7 +562,7 @@ let panelInfo: inputMethodEngine.PanelInfo = {
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
).
then
((
panel
)
=>
{
console
.
log
(
'
Succeed in creating panel.
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to create panel:
${
JSON
.
stringify
(
err
)}
`
);
})
```
...
...
@@ -591,26 +591,26 @@ let panelInfo: inputMethodEngine.PanelInfo = {
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to create panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
globalThis
.
inputMethodPanel
=
panel
;
console
.
log
(
'
Succeed in creating panel.
'
);
})
}
catch
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to create panel:
${
JSON
.
stringify
(
err
)}
`
);
}
try
{
inputMethodEngine
.
getInputMethodAbility
().
destroyPanel
(
globalThis
.
inputMethodPanel
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
console
.
log
(
'
Failed to destroy panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to destroy panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeed in destroying panel.
'
);
})
}
catch
(
err
)
{
console
.
log
(
'
Failed to destroy panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to destroy panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -643,24 +643,24 @@ let panelInfo: inputMethodEngine.PanelInfo = {
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to create panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
globalThis
.
inputMethodPanel
=
panel
;
console
.
log
(
'
Succeed in creating panel.
'
);
})
}
catch
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to create panel:
${
JSON
.
stringify
(
err
)}
`
);
}
try
{
inputMethodEngine
.
getInputMethodAbility
().
destroyPanel
(
globalThis
.
inputMethodPanel
).
then
(()
=>
{
console
.
log
(
'
Succeed in destroying panel.
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
Failed to destroy panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to destroy panel:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
log
(
'
Failed to destroy panel, err:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to destroy panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -895,13 +895,13 @@ setUiContent(path: string, callback: AsyncCallback\<void>): void
try
{
panel
.
setUiContent
(
'
pages/page2/page2
'
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in setting the content.
'
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -933,10 +933,10 @@ try {
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the content.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -964,13 +964,13 @@ storage.setOrCreate('storageSimpleProp',121);
try
{
panel
.
setUiContent
(
'
pages/page2/page2
'
,
storage
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in setting the content.
'
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1005,10 +1005,10 @@ try {
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the content.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to set the content. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1036,13 +1036,13 @@ resize(width: number, height: number, callback: AsyncCallback\<void>): void
try
{
panel
.
resize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to change the panel size. Cause:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in changing the panel size.
'
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to change the panel size. Cause:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1077,10 +1077,10 @@ try {
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in changing the panel size.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to change the panel size. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to change the panel size. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1108,13 +1108,13 @@ moveTo(x: number, y: number, callback: AsyncCallback\<void>): void
try
{
panel
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to move the panel. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in moving the panel.
'
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to move the panel. err:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1149,10 +1149,10 @@ try {
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in moving the panel.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to move the panel. Cause:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
e
xception
)
{
console
.
error
(
'
Failed to move the panel. Cause:
'
+
JSON
.
stringify
(
exception
)
);
}
catch
(
e
rr
)
{
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1175,7 +1175,7 @@ show(callback: AsyncCallback\<void>): void
```
js
panel
.
show
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to show the panel. Cause:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in showing the panel.
'
);
...
...
@@ -1203,7 +1203,7 @@ let promise = panel.show();
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in showing the panel.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to show the panel. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1226,7 +1226,7 @@ hide(callback: AsyncCallback\<void>): void
```
js
panel
.
hide
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to hide the panel. Cause:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in hiding the panel.
'
);
...
...
@@ -1254,7 +1254,7 @@ let promise = panel.hide();
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding the panel.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the panel. err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1354,7 +1354,7 @@ hide(callback: AsyncCallback<void>): void
```
js
keyboardController
.
hide
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to hide keyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hide:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in hiding keyboard.
'
);
...
...
@@ -1389,7 +1389,7 @@ hide(): Promise<void>
keyboardController
.
hide
().
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding keyboard.
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
Failed to hide keyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
info
(
`Failed to hide:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1416,7 +1416,7 @@ hideKeyboard(callback: AsyncCallback<void>): void
```
js
keyboardController
.
hideKeyboard
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to hide Keyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to hideKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in hiding keyboard.
'
);
...
...
@@ -1447,7 +1447,7 @@ hideKeyboard(): Promise<void>
keyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding keyboard.
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
Failed to hide Keyboard:
'
+
JSON
.
stringify
(
err
)
);
console
.
info
(
`Failed to hideKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1532,7 +1532,7 @@ let action = 1;
try
{
inputClient
.
sendKeyFunction
(
action
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -1542,7 +1542,7 @@ try {
}
});
}
catch
(
err
)
{
console
.
error
(
'
sendKeyFunction err:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1586,10 +1586,10 @@ try {
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1624,13 +1624,13 @@ let length = 1;
try
{
inputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in getting forward, text:
'
+
text
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1671,10 +1671,10 @@ try {
inputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting forward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1709,13 +1709,13 @@ let length = 1;
try
{
inputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in getting backward, text:
'
+
text
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1756,10 +1756,10 @@ try {
inputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting backward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1794,17 +1794,17 @@ let length = 1;
try
{
inputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to delete forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting forward.
'
);
}
else
{
console
.
error
(
'
Failed to delete forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
}
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to delete forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1849,10 +1849,10 @@ try {
console
.
error
(
'
Failed to delete Forward.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to delete Forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to delete Forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -1887,13 +1887,13 @@ let length = 1;
try
{
inputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to delete Backward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting backward.
'
);
}
else
{
console
.
error
(
'
Failed to delete Backward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
}
});
}
catch
(
err
)
{
...
...
@@ -1941,7 +1941,7 @@ inputClient.deleteBackward(length).then((result) => {
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to deleteBackward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -1974,7 +1974,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```
js
inputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -2025,10 +2025,10 @@ try {
console
.
error
(
'
Failed to insertText.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2059,7 +2059,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```
js
inputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
...
...
@@ -2096,7 +2096,7 @@ inputClient.getEditorAttribute().then((editorAttribute) => {
console
.
info
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2129,13 +2129,13 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
try
{
inputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_UP
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to moveCursor:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in moving cursor.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to moveCursor:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2174,10 +2174,10 @@ try {
inputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_UP
).
then
(()
=>
{
console
.
log
(
'
Succeeded in moving cursor.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to moveCursor:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
log
(
'
Failed to moveCursor:
'
+
JSON
.
stringify
(
err
)
);
console
.
log
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2211,13 +2211,13 @@ selectByRange(range: Range, callback: AsyncCallback<void>): void
try
{
inputClient
.
selectByRange
({
start
:
0
,
end
:
1
},
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to selectByRange: ${err.message}
'
);
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in selecting by range.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to selectByRange: ${err.message}
'
);
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2257,10 +2257,10 @@ try {
inputClient
.
selectByRange
({
start
:
0
,
end
:
1
}).
then
(()
=>
{
console
.
log
(
'
Succeeded in selecting by range.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to selectByRange: ${err.message}
'
);
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
log
(
'
Failed to selectByRange: ${err.message}
'
);
console
.
log
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2294,13 +2294,13 @@ selectByMovement(movement: Movement, callback: AsyncCallback<void>): void
try
{
inputClient
.
selectByMovement
({
direction
:
1
},
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to selectByMovement: ${err.message}
'
);
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in selecting by movement.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to selectByMovement: ${err.message}
'
);
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2340,10 +2340,10 @@ try {
inputClient
.
selectByMovement
({
direction
:
1
}).
then
(()
=>
{
console
.
log
(
'
Succeeded in selecting by movement.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to selectByMovement: ${err.message}
'
);
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
)
{
console
.
log
(
'
Failed to selectByMovement: ${err.message}
'
);
console
.
log
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2375,7 +2375,7 @@ getTextIndexAtCursor(callback: AsyncCallback<number>): void
```
js
inputClient
.
getTextIndexAtCursor
((
err
,
index
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getTextIndexAtCursor: ${err.message}
'
);
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
info
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
...
...
@@ -2411,7 +2411,7 @@ getTextIndexAtCursor(): Promise<number>
inputClient
.
getTextIndexAtCursor
().
then
((
index
)
=>
{
console
.
info
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getTextIndexAtCursor: ${err.message}
'
);
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2452,8 +2452,8 @@ try {
}
console
.
info
(
'
Succeeded in sending extend action.
'
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2497,8 +2497,8 @@ try {
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
});
}
catch
(
err
or
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
or
)}
`
);
}
catch
(
err
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
}
```
...
...
@@ -2590,7 +2590,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
textInputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in getting forward, text:
'
+
text
);
...
...
@@ -2628,7 +2628,7 @@ let length = 1;
textInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting forward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2657,7 +2657,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
textInputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getBackward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
Succeeded in getting borward, text:
'
+
text
);
...
...
@@ -2695,7 +2695,7 @@ let length = 1;
textInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting backward:
'
+
JSON
.
stringify
(
text
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getBackward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2724,7 +2724,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
textInputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to deleteForward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -2770,7 +2770,7 @@ textInputClient.deleteForward(length).then((result) => {
console
.
error
(
'
Failed to delete forward.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to delete forward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2799,7 +2799,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
textInputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to delete backward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -2845,7 +2845,7 @@ textInputClient.deleteBackward(length).then((result) => {
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to deleteBackward:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
```
### sendKeyFunction<sup>(deprecated)</sup>
...
...
@@ -2873,7 +2873,7 @@ sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void
let
action
=
1
;
textInputClient
.
sendKeyFunction
(
action
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -2919,7 +2919,7 @@ textInputClient.sendKeyFunction(action).then((result) => {
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -2947,7 +2947,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```
js
textInputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
if
(
result
)
{
...
...
@@ -2992,7 +2992,7 @@ textInputClient.insertText('test').then((result) => {
console
.
error
(
'
Failed to insertText.
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
});
```
...
...
@@ -3019,7 +3019,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```
js
textInputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
...
...
@@ -3052,7 +3052,7 @@ textInputClient.getEditorAttribute().then((editorAttribute) => {
console
.
info
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
)
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
});
```
<!--no_check-->
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录