Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
a7235d18
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看板
提交
a7235d18
编写于
9月 27, 2022
作者:
Z
zhaolinglan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for VOD
Signed-off-by:
N
zhaolinglan
<
zhaolinglan@huawei.com
>
上级
62ace83a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
114 addition
and
114 deletion
+114
-114
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
...v/reference/apis/js-apis-inputmethod-extension-context.md
+8
-8
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+28
-28
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+78
-78
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
浏览文件 @
a7235d18
...
...
@@ -47,8 +47,8 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
```
js
let
want
=
{
"
bundleName
"
:
"
com.example.myapp
"
,
"
abilityName
"
:
"
MyAbility
"
};
'
bundleName
'
:
'
com.example.myapp
'
,
'
abilityName
'
:
'
MyAbility
'
};
this
.
context
.
startAbility
(
want
,
(
err
)
=>
{
console
.
log
(
'
startAbility result:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -79,8 +79,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
```
js
let
want
=
{
"
bundleName
"
:
"
com.example.myapp
"
,
"
abilityName
"
:
"
MyAbility
"
'
bundleName
'
:
'
com.example.myapp
'
,
'
abilityName
'
:
'
MyAbility
'
};
this
.
context
.
startAbility
(
want
).
then
((
data
)
=>
{
console
.
log
(
'
success:
'
+
JSON
.
stringify
(
data
));
...
...
@@ -110,15 +110,15 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
```
js
var
want
=
{
"
deviceId
"
:
""
,
"
bundleName
"
:
"
com.extreme.test
"
,
"
abilityName
"
:
"
MainAbility
"
'
deviceId
'
:
''
,
'
bundleName
'
:
'
com.extreme.test
'
,
'
abilityName
'
:
'
MainAbility
'
};
var
options
=
{
windowMode
:
0
,
};
this
.
context
.
startAbility
(
want
,
options
,
(
error
)
=>
{
console
.
log
(
"
error.code =
"
+
error
.
code
)
console
.
log
(
'
error.code =
'
+
error
.
code
)
})
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
a7235d18
...
...
@@ -94,15 +94,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**示例:**
```
js
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
)
{
console
.
error
(
"
switchInputMethod err:
"
+
JSON
.
stringify
(
err
));
console
.
error
(
'
switchInputMethod err:
'
+
JSON
.
stringify
(
err
));
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to switchInputMethod.(callback)
"
);
console
.
info
(
'
Success to switchInputMethod.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to switchInputMethod.(callback)
"
);
console
.
error
(
'
Failed to switchInputMethod.(callback)
'
);
}
});
```
...
...
@@ -129,14 +129,14 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
```
js
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
)
{
console
.
info
(
"
Success to switchInputMethod.(promise)
"
);
console
.
info
(
'
Success to switchInputMethod.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to switchInputMethod.(promise)
"
);
console
.
error
(
'
Failed to switchInputMethod.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
switchInputMethod promise err:
"
+
err
);
console
.
error
(
'
switchInputMethod promise err:
'
+
err
);
})
```
## inputMethod.getCurrentInputMethod<sup>9+</sup>
...
...
@@ -183,13 +183,13 @@ stopInput(callback: AsyncCallback<boolean>): void
```
js
InputMethodController
.
stopInput
((
error
,
result
)
=>
{
if
(
error
)
{
console
.
error
(
"
failed to stopInput because:
"
+
JSON
.
stringify
(
error
));
console
.
error
(
'
failed to stopInput because:
'
+
JSON
.
stringify
(
error
));
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(callback)
"
);
console
.
info
(
'
Success to stopInput.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to stopInput.(callback)
"
);
console
.
error
(
'
Failed to stopInput.(callback)
'
);
}
});
```
...
...
@@ -214,12 +214,12 @@ stopInput(): Promise<boolean>
```
js
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(promise)
"
);
console
.
info
(
'
Success to stopInput.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to stopInput.(promise)
"
);
console
.
error
(
'
Failed to stopInput.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
stopInput promise err:
"
+
err
);
console
.
error
(
'
stopInput promise err:
'
+
err
);
})
```
...
...
@@ -241,7 +241,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
```
js
InputMethodController
.
showSoftKeyboard
((
err
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
=
undefined
)
{
console
.
info
(
'
showSoftKeyboard success
'
);
}
else
{
console
.
error
(
'
showSoftKeyboard failed because :
'
+
JSON
.
stringify
(
err
));
...
...
@@ -292,7 +292,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
```
js
InputMethodController
.
hideSoftKeyboard
((
err
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
=
undefined
)
{
console
.
info
(
'
hideSoftKeyboard success
'
);
}
else
{
console
.
error
(
'
hideSoftKeyboard failed because :
'
+
JSON
.
stringify
(
err
));
...
...
@@ -350,10 +350,10 @@ listInputMethod(enable: boolean, callback: AsyncCallback<Array<InputMethod
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
InputMethodSetting
.
listInputMethod
(
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
"
listInputMethod failed because:
"
+
JSON
.
stringify
(
err
));
console
.
error
(
'
listInputMethod failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
"
listInputMethod success
"
);
console
.
log
(
'
listInputMethod success
'
);
this
.
imeList
=
data
;
});
```
...
...
@@ -383,10 +383,10 @@ listInputMethod(enable: boolean): Promise<Array<InputMethodProperty>>
```
js
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
InputMethodSetting
.
listInputMethod
(
true
).
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod success
"
);
console
.
info
(
'
listInputMethod success
'
);
this
.
imeList
=
data
;
}).
catch
((
err
)
=>
{
console
.
error
(
"
listInputMethod promise err:
"
+
err
);
console
.
error
(
'
listInputMethod promise err:
'
+
err
);
})
```
...
...
@@ -410,10 +410,10 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
InputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
"
listInputMethod failed because:
"
+
JSON
.
stringify
(
err
));
console
.
error
(
'
listInputMethod failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
"
listInputMethod success
"
);
console
.
log
(
'
listInputMethod success
'
);
this
.
imeList
=
data
;
});
```
...
...
@@ -437,10 +437,10 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
```
js
imeList
:
Array
<
inputMethod
.
InputMethodProperty
>
=
null
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod success
"
);
console
.
info
(
'
listInputMethod success
'
);
this
.
imeList
=
data
;
}).
catch
((
err
)
=>
{
console
.
error
(
"
listInputMethod promise err:
"
+
err
);
console
.
error
(
'
listInputMethod promise err:
'
+
err
);
})
```
...
...
@@ -463,10 +463,10 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
```
js
InputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
"
displayOptionalInputMethod failed because:
"
+
JSON
.
stringify
(
err
));
console
.
error
(
'
displayOptionalInputMethod failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
"
displayOptionalInputMethod success
"
);
console
.
info
(
'
displayOptionalInputMethod success
'
);
});
```
...
...
@@ -488,8 +488,8 @@ InputMethodSetting.displayOptionalInputMethod((err) => {
```
js
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
"
displayOptionalInputMethod success.(promise)
"
);
console
.
info
(
'
displayOptionalInputMethod success.(promise)
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
displayOptionalInputMethod promise err:
"
+
err
);
console
.
error
(
'
displayOptionalInputMethod promise err:
'
+
err
);
})
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
a7235d18
...
...
@@ -140,7 +140,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
```
js
InputMethodEngine
.
off
(
'
inputStart
'
,
(
kbController
,
textInputClient
)
=>
{
console
.
log
(
"
delete inputStart notification.
"
);
console
.
log
(
'
delete inputStart notification.
'
);
});
```
...
...
@@ -163,7 +163,7 @@ on(type: 'inputStop', callback: () => void): void
```
js
InputMethodEngine
.
getInputMethodEngine
().
on
(
'
inputStop
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine inputStop
"
);
console
.
log
(
'
inputMethodEngine inputStop
'
);
});
```
...
...
@@ -186,7 +186,7 @@ off(type: 'inputStop', callback: () => void): void
```
js
InputMethodEngine
.
getInputMethodEngine
().
off
(
'
inputStop
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine delete inputStop notification.
"
);
console
.
log
(
'
inputMethodEngine delete inputStop notification.
'
);
});
```
...
...
@@ -209,7 +209,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
```
js
InputMethodEngine
.
getInputMethodEngine
().
on
(
'
setCallingWindow
'
,
(
wid
)
=>
{
console
.
log
(
"
inputMethodEngine setCallingWindow
"
);
console
.
log
(
'
inputMethodEngine setCallingWindow
'
);
});
```
...
...
@@ -232,7 +232,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
```
js
InputMethodEngine
.
getInputMethodEngine
().
off
(
'
setCallingWindow
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine delete setCallingWindow notification.
"
);
console
.
log
(
'
inputMethodEngine delete setCallingWindow notification.
'
);
});
```
...
...
@@ -255,10 +255,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
```
js
InputMethodEngine
.
on
(
'
keyboardShow
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine keyboardShow.
"
);
console
.
log
(
'
inputMethodEngine keyboardShow.
'
);
});
InputMethodEngine
.
on
(
'
keyboardHide
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine keyboardHide.
"
);
console
.
log
(
'
inputMethodEngine keyboardHide.
'
);
});
```
...
...
@@ -281,10 +281,10 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
```
js
InputMethodEngine
.
off
(
'
keyboardShow
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine delete keyboardShow notification.
"
);
console
.
log
(
'
inputMethodEngine delete keyboardShow notification.
'
);
});
InputMethodEngine
.
off
(
'
keyboardHide
'
,
()
=>
{
console
.
log
(
"
inputMethodEngine delete keyboardHide notification.
"
);
console
.
log
(
'
inputMethodEngine delete keyboardHide notification.
'
);
});
```
...
...
@@ -314,13 +314,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
```
js
KeyboardDelegate
.
on
(
'
keyUp
'
,
(
keyEvent
)
=>
{
console
.
info
(
"
inputMethodEngine keyCode.(keyUp):
"
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
"
inputMethodEngine keyAction.(keyUp):
"
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
console
.
info
(
'
inputMethodEngine keyCode.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
'
inputMethodEngine keyAction.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
return
true
;
});
KeyboardDelegate
.
on
(
'
keyDown
'
,
(
keyEvent
)
=>
{
console
.
info
(
"
inputMethodEngine keyCode.(keyDown):
"
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
"
inputMethodEngine keyAction.(keyDown):
"
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
console
.
info
(
'
inputMethodEngine keyCode.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
'
inputMethodEngine keyAction.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
return
true
;
});
```
...
...
@@ -344,11 +344,11 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
```
js
KeyboardDelegate
.
off
(
'
keyUp
'
,
(
keyEvent
)
=>
{
console
.
log
(
"
delete keyUp notification.
"
);
console
.
log
(
'
delete keyUp notification.
'
);
return
true
;
});
KeyboardDelegate
.
off
(
'
keyDown
'
,
(
keyEvent
)
=>
{
console
.
log
(
"
delete keyDown notification.
"
);
console
.
log
(
'
delete keyDown notification.
'
);
return
true
;
});
```
...
...
@@ -374,9 +374,9 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
```
js
KeyboardDelegate
.
on
(
'
cursorContextChange
'
,
(
x
,
y
,
height
)
=>
{
console
.
log
(
"
inputMethodEngine cursorContextChange x:
"
+
x
);
console
.
log
(
"
inputMethodEngine cursorContextChange y:
"
+
y
);
console
.
log
(
"
inputMethodEngine cursorContextChange height:
"
+
height
);
console
.
log
(
'
inputMethodEngine cursorContextChange x:
'
+
x
);
console
.
log
(
'
inputMethodEngine cursorContextChange y:
'
+
y
);
console
.
log
(
'
inputMethodEngine cursorContextChange height:
'
+
height
);
});
```
...
...
@@ -400,7 +400,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
```
js
KeyboardDelegate
.
off
(
'
cursorContextChange
'
,
(
x
,
y
,
height
)
=>
{
console
.
log
(
"
delete cursorContextChange notification.
"
);
console
.
log
(
'
delete cursorContextChange notification.
'
);
});
```
### on('selectionChange')
...
...
@@ -422,10 +422,10 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
```
js
KeyboardDelegate
.
on
(
'
selectionChange
'
,
(
oldBegin
,
oldEnd
,
newBegin
,
newEnd
)
=>
{
console
.
log
(
"
inputMethodEngine beforeEach selectionChange oldBegin:
"
+
oldBegin
);
console
.
log
(
"
inputMethodEngine beforeEach selectionChange oldEnd:
"
+
oldEnd
);
console
.
log
(
"
inputMethodEngine beforeEach selectionChange newBegin:
"
+
newBegin
);
console
.
log
(
"
inputMethodEngine beforeEach selectionChange newEnd:
"
+
newEnd
);
console
.
log
(
'
inputMethodEngine beforeEach selectionChange oldBegin:
'
+
oldBegin
);
console
.
log
(
'
inputMethodEngine beforeEach selectionChange oldEnd:
'
+
oldEnd
);
console
.
log
(
'
inputMethodEngine beforeEach selectionChange newBegin:
'
+
newBegin
);
console
.
log
(
'
inputMethodEngine beforeEach selectionChange newEnd:
'
+
newEnd
);
});
```
...
...
@@ -448,7 +448,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
```
js
KeyboardDelegate
.
off
(
'
selectionChange
'
,
(
oldBegin
,
oldEnd
,
newBegin
,
newEnd
)
=>
{
console
.
log
(
"
delete selectionChange notification.
"
);
console
.
log
(
'
delete selectionChange notification.
'
);
});
```
...
...
@@ -472,7 +472,7 @@ on(type: 'textChange', callback: (text: string) => void): void
```
js
KeyboardDelegate
.
on
(
'
textChange
'
,
(
text
)
=>
{
console
.
log
(
"
inputMethodEngine textChange. text:
"
+
text
);
console
.
log
(
'
inputMethodEngine textChange. text:
'
+
text
);
});
```
...
...
@@ -495,7 +495,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
```
js
keyboardDelegate
.
off
(
'
textChange
'
,
(
text
)
=>
{
console
.
log
(
"
delete textChange notification. text:
"
+
text
);
console
.
log
(
'
delete textChange notification. text:
'
+
text
);
});
```
...
...
@@ -522,11 +522,11 @@ hideKeyboard(callback: AsyncCallback<void>): void
```
js
KeyboardController
.
hideKeyboard
((
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
hideKeyboard callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
hideKeyboard callback result---err:
'
+
err
.
msg
);
return
;
}
console
.
log
(
"
hideKeyboard callback.
"
);
console
.
log
(
'
hideKeyboard callback.
'
);
});
```
...
...
@@ -549,9 +549,9 @@ hideKeyboard(): Promise<void>
```
js
async
function
InputMethodEngine
()
{
await
KeyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
"
hideKeyboard promise.
"
);
console
.
info
(
'
hideKeyboard promise.
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
hideKeyboard promise err:
"
+
err
.
msg
);
console
.
info
(
'
hideKeyboard promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -580,11 +580,11 @@ getForward(length:number, callback: AsyncCallback<string>): void
```
js
var
length
=
1
;
TextInputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
getForward callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
getForward callback result---err:
'
+
err
.
msg
);
return
;
}
console
.
log
(
"
getForward callback result---text:
"
+
text
);
console
.
log
(
'
getForward callback result---text:
'
+
text
);
});
```
...
...
@@ -614,9 +614,9 @@ getForward(length:number): Promise<string>
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getForward promise result---res:
"
+
text
);
console
.
info
(
'
getForward promise result---res:
'
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getForward promise err:
"
+
err
.
msg
);
console
.
error
(
'
getForward promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -641,11 +641,11 @@ getBackward(length:number, callback: AsyncCallback<string>): void
```
js
var
length
=
1
;
TextInputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
getBackward callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
getBackward callback result---err:
'
+
err
.
msg
);
return
;
}
console
.
log
(
"
getBackward callback result---text:
"
+
text
);
console
.
log
(
'
getBackward callback result---text:
'
+
text
);
});
```
...
...
@@ -675,9 +675,9 @@ getBackward(length:number): Promise<string>
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getBackward promise result---res:
"
+
text
);
console
.
info
(
'
getBackward promise result---res:
'
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getBackward promise err:
"
+
err
.
msg
);
console
.
error
(
'
getBackward promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -702,14 +702,14 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
```
js
var
length
=
1
;
TextInputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
=
undefined
)
{
console
.
error
(
'
deleteForward callback result---err:
'
+
err
.
msg
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to deleteForward.(callback)
"
);
console
.
info
(
'
Success to deleteForward.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to deleteForward.(callback)
"
);
console
.
error
(
'
Failed to deleteForward.(callback)
'
);
}
});
```
...
...
@@ -740,12 +740,12 @@ async function InputMethodEngine() {
var
length
=
1
;
await
TextInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteForward.(promise)
"
);
console
.
info
(
'
Success to deleteForward.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to deleteForward.(promise)
"
);
console
.
error
(
'
Failed to deleteForward.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteForward promise err:
"
+
err
.
msg
);
console
.
error
(
'
deleteForward promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -770,14 +770,14 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
```
js
var
length
=
1
;
TextInputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
deleteBackward callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
deleteBackward callback result---err:
'
+
err
.
msg
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to deleteBackward.(callback)
"
);
console
.
info
(
'
Success to deleteBackward.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to deleteBackward.(callback)
"
);
console
.
error
(
'
Failed to deleteBackward.(callback)
'
);
}
});
```
...
...
@@ -809,12 +809,12 @@ async function InputMethodEngine() {
var
length
=
1
;
await
TextInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteBackward.(promise)
"
);
console
.
info
(
'
Success to deleteBackward.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to deleteBackward.(promise)
"
);
console
.
error
(
'
Failed to deleteBackward.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteBackward promise err:
"
+
err
.
msg
);
console
.
error
(
'
deleteBackward promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -837,14 +837,14 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
```
js
TextInputClient
.
sendKeyFunction
(
keyFunction
,
(
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
sendKeyFunction callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
sendKeyFunction callback result---err:
'
+
err
.
msg
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to sendKeyFunction.(callback)
"
);
console
.
info
(
'
Success to sendKeyFunction.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to sendKeyFunction.(callback)
"
);
console
.
error
(
'
Failed to sendKeyFunction.(callback)
'
);
}
});
```
...
...
@@ -875,12 +875,12 @@ sendKeyFunction(action:number): Promise<boolean>
async
function
InputMethodEngine
()
{
await
client
.
sendKeyFunction
(
keyFunction
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to sendKeyFunction.(promise)
"
);
console
.
info
(
'
Success to sendKeyFunction.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to sendKeyFunction.(promise)
"
);
console
.
error
(
'
Failed to sendKeyFunction.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
sendKeyFunction promise err:
"
+
err
.
msg
);
console
.
error
(
'
sendKeyFunction promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -904,14 +904,14 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```
js
TextInputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
insertText callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
insertText callback result---err:
'
+
err
.
msg
);
return
;
}
if
(
result
)
{
console
.
info
(
"
Success to insertText.(callback)
"
);
console
.
info
(
'
Success to insertText.(callback)
'
);
}
else
{
console
.
error
(
"
Failed to insertText.(callback)
"
);
console
.
error
(
'
Failed to insertText.(callback)
'
);
}
});
```
...
...
@@ -942,12 +942,12 @@ insertText(text:string): Promise<boolean>
async
function
InputMethodEngine
()
{
await
TextInputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to insertText.(promise)
"
);
console
.
info
(
'
Success to insertText.(promise)
'
);
}
else
{
console
.
error
(
"
Failed to insertText.(promise)
"
);
console
.
error
(
'
Failed to insertText.(promise)
'
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
insertText promise err:
"
+
err
.
msg
);
console
.
error
(
'
insertText promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -970,12 +970,12 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```
js
TextInputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
getEditorAttribute callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
getEditorAttribute callback result---err:
'
+
err
.
msg
);
return
;
}
console
.
log
(
"
editorAttribute.inputPattern(callback):
"
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
"
editorAttribute.enterKeyType(callback):
"
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
log
(
'
editorAttribute.inputPattern(callback):
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.enterKeyType(callback):
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
});
```
...
...
@@ -998,10 +998,10 @@ getEditorAttribute(): Promise<EditorAttribute>
```
js
async
function
InputMethodEngine
()
{
await
TextInputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
"
editorAttribute.inputPattern(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
"
editorAttribute.enterKeyType(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
info
(
'
editorAttribute.inputPattern(promise):
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType(promise):
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
console
.
error
(
"
getEditorAttribute promise err:
"
+
err
.
msg
);
console
.
error
(
'
getEditorAttribute promise err:
'
+
err
.
msg
);
});
}
```
...
...
@@ -1025,8 +1025,8 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
```
js
TextInputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_xxx
,
(
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
moveCursor callback result---err:
"
+
err
.
msg
);
if
(
err
==
=
undefined
)
{
console
.
error
(
'
moveCursor callback result---err:
'
+
err
.
msg
);
return
;
}
});
...
...
@@ -1059,7 +1059,7 @@ async function InputMethodEngine() {
await
TextInputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_xxx
).
then
(
async
(
err
)
=>
{
console
.
log
(
'
moveCursor success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
moveCursor success err:
"
+
err
.
msg
);
console
.
error
(
'
moveCursor success err:
'
+
err
.
msg
);
});
}
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录