Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
514c979d
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看板
提交
514c979d
编写于
3月 03, 2023
作者:
M
mingxihua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mingxihua@huawei.com.cn
Signed-off-by:
N
mingxihua
<
mingxihua@huawei.com
>
上级
ed84c4a8
变更
53
隐藏空白更改
内联
并排
Showing
53 changed file
with
715 addition
and
525 deletion
+715
-525
zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md
...tion-dev/reference/apis/js-apis-ability-featureAbility.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md
...ion-dev/reference/apis/js-apis-ability-particleAbility.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
...dev/reference/apis/js-apis-app-ability-abilityConstant.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md
...ence/apis/js-apis-app-ability-abilityDelegatorRegistry.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md
...ence/apis/js-apis-app-ability-abilityLifecycleCallback.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
...-dev/reference/apis/js-apis-app-ability-abilityManager.md
+14
-14
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
...tion-dev/reference/apis/js-apis-app-ability-appManager.md
+28
-28
zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
...ion-dev/reference/apis/js-apis-app-ability-appRecovery.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md
...n-dev/reference/apis/js-apis-app-ability-configuration.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md
...reference/apis/js-apis-app-ability-environmentCallback.md
+5
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md
...on-dev/reference/apis/js-apis-app-ability-errorManager.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md
...-dev/reference/apis/js-apis-app-ability-missionManager.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
...dev/reference/apis/js-apis-app-ability-quickFixManager.md
+8
-8
zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md
...on-dev/reference/apis/js-apis-app-ability-startOptions.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
...pplication-dev/reference/apis/js-apis-app-ability-want.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md
...ation-dev/reference/apis/js-apis-app-ability-wantAgent.md
+53
-53
zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md
...on-dev/reference/apis/js-apis-app-form-formBindingData.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md
...plication-dev/reference/apis/js-apis-app-form-formHost.md
+72
-72
zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md
...ation-dev/reference/apis/js-apis-app-form-formProvider.md
+28
-28
zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md
...-dev/reference/apis/js-apis-application-abilityManager.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-application-appManager.md
...tion-dev/reference/apis/js-apis-application-appManager.md
+38
-26
zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
...nce/apis/js-apis-application-dataShareExtensionAbility.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md
...reference/apis/js-apis-application-environmentCallback.md
+7
-3
zh-cn/application-dev/reference/apis/js-apis-application-formBindingData.md
...dev/reference/apis/js-apis-application-formBindingData.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-application-formProvider.md
...on-dev/reference/apis/js-apis-application-formProvider.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md
...-dev/reference/apis/js-apis-application-missionManager.md
+52
-42
zh-cn/application-dev/reference/apis/js-apis-application-want.md
...pplication-dev/reference/apis/js-apis-application-want.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md
...reference/apis/js-apis-inner-ability-dataAbilityHelper.md
+80
-36
zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md
...rence/apis/js-apis-inner-ability-startAbilityParameter.md
+7
-4
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
...lication-dev/reference/apis/js-apis-inner-ability-want.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md
...plication-dev/reference/apis/js-apis-inner-app-context.md
+126
-46
zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md
...ation-dev/reference/apis/js-apis-inner-app-processInfo.md
+5
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
...erence/apis/js-apis-inner-application-abilityDelegator.md
+17
-9
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md
...eference/apis/js-apis-inner-application-abilityMonitor.md
+5
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md
...ence/apis/js-apis-inner-application-abilityRunningInfo.md
+14
-10
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md
...nce/apis/js-apis-inner-application-abilityStageMonitor.md
+5
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md
...s-apis-inner-application-accessibilityExtensionContext.md
+17
-17
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md
...ence/apis/js-apis-inner-application-applicationContext.md
+5
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
...n-dev/reference/apis/js-apis-inner-application-context.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md
...erence/apis/js-apis-inner-application-continueCallback.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
...ence/apis/js-apis-inner-application-continueDeviceInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md
...reference/apis/js-apis-inner-application-errorObserver.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md
...ce/apis/js-apis-inner-application-extensionRunningInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
...ce/apis/js-apis-inner-application-formExtensionContext.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
...v/reference/apis/js-apis-inner-application-missionInfo.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
...ference/apis/js-apis-inner-application-missionListener.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionParameter.md
...erence/apis/js-apis-inner-application-missionParameter.md
+6
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md
...ference/apis/js-apis-inner-application-missionSnapshot.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md
...ence/apis/js-apis-inner-application-processInformation.md
+5
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md
...ence/apis/js-apis-inner-application-processRunningInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
...apis/js-apis-inner-application-serviceExtensionContext.md
+41
-41
zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md
...eference/apis/js-apis-inner-application-shellCmdResult.md
+6
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md
.../apis/js-apis-inner-application-windowExtensionContext.md
+2
-2
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md
浏览文件 @
514c979d
...
@@ -851,7 +851,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
...
@@ -851,7 +851,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 表示迁移是否是可反向的。 |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 表示迁移是否是可反向的。 |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | 表示如果未安装指定的Ability,将安装该Ability。 |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | 表示如果未安装指定的Ability,将安装该Ability。 |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 表示如果未安装指定的Ability,将在后台安装该Ability。 |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 表示如果未安装指定的Ability,将在后台安装该Ability。 |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 表示清除其他任务的操作。可以为传递给
**[ohos.app.Context](js-apis-ability-context.md)**
中
**startAbility**
方法的
**Want**
设置此标志,并且必须与
**
flag
_ABILITY_NEW_MISSION**
一起使用。 |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 表示清除其他任务的操作。可以为传递给
**[ohos.app.Context](js-apis-ability-context.md)**
中
**startAbility**
方法的
**Want**
设置此标志,并且必须与
**
FLAG
_ABILITY_NEW_MISSION**
一起使用。 |
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | 表示在已有的任务栈上创建任务的操作。 |
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | 表示在已有的任务栈上创建任务的操作。 |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | 表示如果启动的Ability的现有实例已位于任务栈顶,则将重用该实例。否则,将创建一个新的Ability实例。 |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | 表示如果启动的Ability的现有实例已位于任务栈顶,则将重用该实例。否则,将创建一个新的Ability实例。 |
zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md
浏览文件 @
514c979d
...
@@ -429,11 +429,11 @@ function onConnectCallback(element, remote) {
...
@@ -429,11 +429,11 @@ function onConnectCallback(element, remote) {
}
}
function
onDisconnectCallback
(
element
)
{
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId
: ${element.deviceId}
'
);
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId: ${element.deviceId}
'
);
}
}
function
onFailedCallback
(
code
)
{
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
console
.
error
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
}
}
let
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
...
@@ -449,9 +449,9 @@ let connId = particleAbility.connectAbility(
...
@@ -449,9 +449,9 @@ let connId = particleAbility.connectAbility(
);
);
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
console
.
log
(
'
data: ${data}
'
);
console
.
log
(
'
data: ${data}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
particleAbilityTest result errCode
: ${error.code}
'
);
console
.
error
(
'
particleAbilityTest result errCode
: ${error.code}
'
);
});
});
```
```
...
@@ -480,11 +480,11 @@ function onConnectCallback(element, remote) {
...
@@ -480,11 +480,11 @@ function onConnectCallback(element, remote) {
}
}
function
onDisconnectCallback
(
element
)
{
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId
: ${element.deviceId}
'
);
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId: ${element.deviceId}
'
);
}
}
function
onFailedCallback
(
code
)
{
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
console
.
error
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
}
}
let
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
...
@@ -500,7 +500,7 @@ let connId = particleAbility.connectAbility(
...
@@ -500,7 +500,7 @@ let connId = particleAbility.connectAbility(
);
);
particleAbility
.
disconnectAbility
(
connId
,
(
err
)
=>
{
particleAbility
.
disconnectAbility
(
connId
,
(
err
)
=>
{
console
.
log
(
'
particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}
'
);
});
});
```
```
...
@@ -530,11 +530,11 @@ function onConnectCallback(element, remote) {
...
@@ -530,11 +530,11 @@ function onConnectCallback(element, remote) {
}
}
function
onDisconnectCallback
(
element
)
{
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId
: ${element.deviceId}
'
);
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId: ${element.deviceId}
'
);
}
}
function
onFailedCallback
(
code
)
{
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
console
.
error
(
'
particleAbilityTest ConnectAbility onFailed errCode
: ${code}
'
);
}
}
let
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
...
@@ -552,7 +552,7 @@ let connId = particleAbility.connectAbility(
...
@@ -552,7 +552,7 @@ let connId = particleAbility.connectAbility(
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
console
.
log
(
'
data: ${data}
'
);
console
.
log
(
'
data: ${data}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
particleAbilityTest result errCode : ${error.code}
'
);
console
.
error
(
'
particleAbilityTest result errCode : ${error.code}
'
);
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
浏览文件 @
514c979d
...
@@ -135,7 +135,7 @@ let option = {
...
@@ -135,7 +135,7 @@ let option = {
this
.
context
.
startAbility
(
want
,
option
).
then
(()
=
{
this
.
context
.
startAbility
(
want
,
option
).
then
(()
=
{
console
.
log
(
'
Succeed to start ability.
'
);
console
.
log
(
'
Succeed to start ability.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
Failed to start ability with error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
Failed to start ability with error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md
浏览文件 @
514c979d
...
@@ -56,7 +56,7 @@ abilityDelegator.startAbility(want, (err) => {
...
@@ -56,7 +56,7 @@ abilityDelegator.startAbility(want, (err) => {
if
(
!
err
||
err
.
code
===
0
)
{
if
(
!
err
||
err
.
code
===
0
)
{
console
.
log
(
'
Success start ability.
'
);
console
.
log
(
'
Success start ability.
'
);
}
else
{
}
else
{
console
.
log
(
'
Failed start ability, error: ${JSON.stringify(err)}
'
);
console
.
error
(
'
Failed start ability, error: ${JSON.stringify(err)}
'
);
}
}
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md
浏览文件 @
514c979d
...
@@ -277,7 +277,7 @@ export default class MyFirstAbility extends UIAbility {
...
@@ -277,7 +277,7 @@ export default class MyFirstAbility extends UIAbility {
globalThis
.
lifecycleId
=
applicationContext
.
on
(
'
abilityLifecycle
'
,
abilityLifecycleCallback
);
globalThis
.
lifecycleId
=
applicationContext
.
on
(
'
abilityLifecycle
'
,
abilityLifecycleCallback
);
console
.
log
(
'
registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}
'
);
console
.
log
(
'
registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}
'
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
}
}
}
}
...
@@ -293,7 +293,7 @@ export default class MySecondAbility extends UIAbility {
...
@@ -293,7 +293,7 @@ export default class MySecondAbility extends UIAbility {
// 3.通过applicationContext注销监听应用内生命周期
// 3.通过applicationContext注销监听应用内生命周期
applicationContext
.
off
(
'
abilityLifecycle
'
,
globalThis
.
lifecycleId
,
(
error
)
=>
{
applicationContext
.
off
(
'
abilityLifecycle
'
,
globalThis
.
lifecycleId
,
(
error
)
=>
{
if
(
error
&&
error
.
code
!==
0
)
{
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}
'
);
}
else
{
}
else
{
console
.
log
(
'
unregisterAbilityLifecycleCallback success.
'
);
console
.
log
(
'
unregisterAbilityLifecycleCallback success.
'
);
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
浏览文件 @
514c979d
...
@@ -72,13 +72,13 @@ const config = {
...
@@ -72,13 +72,13 @@ const config = {
try
{
try
{
abilityManager
.
updateConfiguration
(
config
,
(
err
)
=>
{
abilityManager
.
updateConfiguration
(
config
,
(
err
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
updateConfiguration fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
updateConfiguration fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
updateConfiguration success.
'
);
console
.
log
(
'
updateConfiguration success.
'
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -130,10 +130,10 @@ try {
...
@@ -130,10 +130,10 @@ try {
abilityManager
.
updateConfiguration
(
config
).
then
(()
=>
{
abilityManager
.
updateConfiguration
(
config
).
then
(()
=>
{
console
.
log
(
'
updateConfiguration success.
'
);
console
.
log
(
'
updateConfiguration success.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
updateConfiguration fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
updateConfiguration fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -169,13 +169,13 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -169,13 +169,13 @@ import abilityManager from '@ohos.app.ability.abilityManager';
try
{
try
{
abilityManager
.
getAbilityRunningInfos
((
err
,
data
)
=>
{
abilityManager
.
getAbilityRunningInfos
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getAbilityRunningInfos fail, error: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getAbilityRunningInfos fail, error: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
getAbilityRunningInfos success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getAbilityRunningInfos success, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -212,10 +212,10 @@ try {
...
@@ -212,10 +212,10 @@ try {
abilityManager
.
getAbilityRunningInfos
().
then
((
data
)
=>
{
abilityManager
.
getAbilityRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
'
getAbilityRunningInfos success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getAbilityRunningInfos success, data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getAbilityRunningInfos fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getAbilityRunningInfos fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -254,13 +254,13 @@ let upperLimit = 10;
...
@@ -254,13 +254,13 @@ let upperLimit = 10;
try
{
try
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
err
,
data
)
=>
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getExtensionRunningInfos fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getExtensionRunningInfos fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
getExtensionRunningInfos success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getExtensionRunningInfos success, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -305,10 +305,10 @@ try {
...
@@ -305,10 +305,10 @@ try {
abilityManager
.
getExtensionRunningInfos
(
upperLimit
).
then
((
data
)
=>
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
).
then
((
data
)
=>
{
console
.
log
(
'
getExtensionRunningInfos success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getExtensionRunningInfos success, data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getExtensionRunningInfos fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getExtensionRunningInfos fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -341,7 +341,7 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -341,7 +341,7 @@ import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager
.
getTopAbility
((
err
,
data
)
=>
{
abilityManager
.
getTopAbility
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getTopAbility fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getTopAbility fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
getTopAbility success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getTopAbility success, data: ${JSON.stringify(data)}
'
);
}
}
...
@@ -378,6 +378,6 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -378,6 +378,6 @@ import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager
.
getTopAbility
().
then
((
data
)
=>
{
abilityManager
.
getTopAbility
().
then
((
data
)
=>
{
console
.
log
(
'
getTopAbility success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getTopAbility success, data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getTopAbility fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getTopAbility fail, err: ${JSON.stringify(err)}
'
);
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
浏览文件 @
514c979d
...
@@ -41,7 +41,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -41,7 +41,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
isRunningInStabilityTest
((
err
,
flag
)
=>
{
appManager
.
isRunningInStabilityTest
((
err
,
flag
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
isRunningInStabilityTest fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
isRunningInStabilityTest fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
}
}
...
@@ -79,7 +79,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -79,7 +79,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
isRunningInStabilityTest
().
then
((
flag
)
=>
{
appManager
.
isRunningInStabilityTest
().
then
((
flag
)
=>
{
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -114,7 +114,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -114,7 +114,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
isRamConstrainedDevice
().
then
((
data
)
=>
{
appManager
.
isRamConstrainedDevice
().
then
((
data
)
=>
{
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -147,7 +147,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -147,7 +147,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
isRamConstrainedDevice
((
err
,
data
)
=>
{
appManager
.
isRamConstrainedDevice
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
isRamConstrainedDevice fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
isRamConstrainedDevice fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
}
}
...
@@ -184,7 +184,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -184,7 +184,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getAppMemorySize
().
then
((
data
)
=>
{
appManager
.
getAppMemorySize
().
then
((
data
)
=>
{
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -217,7 +217,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -217,7 +217,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getAppMemorySize
((
err
,
data
)
=>
{
appManager
.
getAppMemorySize
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getAppMemorySize fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getAppMemorySize fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
}
}
...
@@ -256,7 +256,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -256,7 +256,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getRunningProcessInformation
().
then
((
data
)
=>
{
appManager
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
'
The running process information is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The running process information is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -291,7 +291,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -291,7 +291,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getRunningProcessInformation
((
err
,
data
)
=>
{
appManager
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getRunningProcessInformation fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getRunningProcessInformation fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
The process running information is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The process running information is: ${JSON.stringify(data)}
'
);
}
}
...
@@ -357,7 +357,7 @@ try {
...
@@ -357,7 +357,7 @@ try {
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
);
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
console
.
error
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
}
}
```
```
...
@@ -422,7 +422,7 @@ try {
...
@@ -422,7 +422,7 @@ try {
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
console
.
error
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
}
}
```
```
...
@@ -484,13 +484,13 @@ try {
...
@@ -484,13 +484,13 @@ try {
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
console
.
error
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
}
}
// 2.注销应用状态监听器
// 2.注销应用状态监听器
function
unregisterApplicationStateObserverCallback
(
err
)
{
function
unregisterApplicationStateObserverCallback
(
err
)
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
unregisterApplicationStateObserverCallback success.
'
);
console
.
log
(
'
unregisterApplicationStateObserverCallback success.
'
);
}
}
...
@@ -498,7 +498,7 @@ function unregisterApplicationStateObserverCallback(err) {
...
@@ -498,7 +498,7 @@ function unregisterApplicationStateObserverCallback(err) {
try
{
try
{
appManager
.
off
(
'
applicationState
'
,
observerId
,
unregisterApplicationStateObserverCallback
);
appManager
.
off
(
'
applicationState
'
,
observerId
,
unregisterApplicationStateObserverCallback
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -565,7 +565,7 @@ try {
...
@@ -565,7 +565,7 @@ try {
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
console
.
error
(
`[appManager] error:
${
paramError
.
code
}
,
${
paramError
.
message
}
`
);
}
}
// 2.注销应用状态监听器
// 2.注销应用状态监听器
...
@@ -573,10 +573,10 @@ try {
...
@@ -573,10 +573,10 @@ try {
appManager
.
off
(
'
applicationState
'
,
observerId
).
then
((
data
)
=>
{
appManager
.
off
(
'
applicationState
'
,
observerId
).
then
((
data
)
=>
{
console
.
log
(
'
unregisterApplicationStateObserver success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
unregisterApplicationStateObserver success, data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
unregisterApplicationStateObserver fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
unregisterApplicationStateObserver fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -613,7 +613,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -613,7 +613,7 @@ import appManager from '@ohos.app.ability.appManager';
function
getForegroundApplicationsCallback
(
err
,
data
)
{
function
getForegroundApplicationsCallback
(
err
,
data
)
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}
'
);
}
}
...
@@ -621,7 +621,7 @@ function getForegroundApplicationsCallback(err, data) {
...
@@ -621,7 +621,7 @@ function getForegroundApplicationsCallback(err, data) {
try
{
try
{
appManager
.
getForegroundApplications
(
getForegroundApplicationsCallback
);
appManager
.
getForegroundApplications
(
getForegroundApplicationsCallback
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -659,7 +659,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -659,7 +659,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getForegroundApplications
().
then
((
data
)
=>
{
appManager
.
getForegroundApplications
().
then
((
data
)
=>
{
console
.
log
(
'
getForegroundApplications success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getForegroundApplications success, data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getForegroundApplications fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getForegroundApplications fail, err: ${JSON.stringify(err)}
'
);
});
});
```
```
...
@@ -746,7 +746,7 @@ let bundleName = 'bundleName';
...
@@ -746,7 +746,7 @@ let bundleName = 'bundleName';
let
accountId
=
0
;
let
accountId
=
0
;
function
killProcessWithAccountCallback
(
err
,
data
)
{
function
killProcessWithAccountCallback
(
err
,
data
)
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
killProcessWithAccountCallback success.
'
);
console
.
log
(
'
killProcessWithAccountCallback success.
'
);
}
}
...
@@ -789,7 +789,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -789,7 +789,7 @@ import appManager from '@ohos.app.ability.appManager';
let
bundleName
=
'
bundleName
'
;
let
bundleName
=
'
bundleName
'
;
function
killProcessesByBundleNameCallback
(
err
,
data
)
{
function
killProcessesByBundleNameCallback
(
err
,
data
)
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
killProcessesByBundleNameCallback success.
'
);
console
.
log
(
'
killProcessesByBundleNameCallback success.
'
);
}
}
...
@@ -797,7 +797,7 @@ function killProcessesByBundleNameCallback(err, data) {
...
@@ -797,7 +797,7 @@ function killProcessesByBundleNameCallback(err, data) {
try
{
try
{
appManager
.
killProcessesByBundleName
(
bundleName
,
killProcessesByBundleNameCallback
);
appManager
.
killProcessesByBundleName
(
bundleName
,
killProcessesByBundleNameCallback
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -843,10 +843,10 @@ try {
...
@@ -843,10 +843,10 @@ try {
appManager
.
killProcessesByBundleName
(
bundleName
).
then
((
data
)
=>
{
appManager
.
killProcessesByBundleName
(
bundleName
).
then
((
data
)
=>
{
console
.
log
(
'
killProcessesByBundleName success.
'
);
console
.
log
(
'
killProcessesByBundleName success.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
killProcessesByBundleName fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
killProcessesByBundleName fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -885,7 +885,7 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -885,7 +885,7 @@ import appManager from '@ohos.app.ability.appManager';
let
bundleName
=
'
bundleName
'
;
let
bundleName
=
'
bundleName
'
;
function
clearUpApplicationDataCallback
(
err
,
data
)
{
function
clearUpApplicationDataCallback
(
err
,
data
)
{
if
(
err
&&
err
.
code
!==
0
)
{
if
(
err
&&
err
.
code
!==
0
)
{
console
.
log
(
'
clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}
'
);
}
else
{
}
else
{
console
.
log
(
'
clearUpApplicationDataCallback success.
'
);
console
.
log
(
'
clearUpApplicationDataCallback success.
'
);
}
}
...
@@ -893,7 +893,7 @@ function clearUpApplicationDataCallback(err, data) {
...
@@ -893,7 +893,7 @@ function clearUpApplicationDataCallback(err, data) {
try
{
try
{
appManager
.
clearUpApplicationData
(
bundleName
,
clearUpApplicationDataCallback
);
appManager
.
clearUpApplicationData
(
bundleName
,
clearUpApplicationDataCallback
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -939,10 +939,10 @@ try {
...
@@ -939,10 +939,10 @@ try {
appManager
.
clearUpApplicationData
(
bundleName
).
then
((
data
)
=>
{
appManager
.
clearUpApplicationData
(
bundleName
).
then
((
data
)
=>
{
console
.
log
(
'
clearUpApplicationData success.
'
);
console
.
log
(
'
clearUpApplicationData success.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
clearUpApplicationData fail, err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
clearUpApplicationData fail, err: ${JSON.stringify(err)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
浏览文件 @
514c979d
...
@@ -105,7 +105,7 @@ let observer = {
...
@@ -105,7 +105,7 @@ let observer = {
try
{
try
{
errorManager
.
on
(
'
error
'
,
observer
);
errorManager
.
on
(
'
error
'
,
observer
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -139,6 +139,6 @@ let observer = {
...
@@ -139,6 +139,6 @@ let observer = {
try
{
try
{
errorManager
.
on
(
'
error
'
,
observer
);
errorManager
.
on
(
'
error
'
,
observer
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md
浏览文件 @
514c979d
...
@@ -42,7 +42,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -42,7 +42,7 @@ export default class EntryAbility extends UIAbility {
let
callbackId
=
applicationContext
.
on
(
'
environment
'
,
envCallback
);
let
callbackId
=
applicationContext
.
on
(
'
environment
'
,
envCallback
);
console
.
log
(
'
callbackId: ${callbackId}
'
);
console
.
log
(
'
callbackId: ${callbackId}
'
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
}
}
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md
浏览文件 @
514c979d
...
@@ -73,7 +73,11 @@ export default class MyAbility extends UIAbility {
...
@@ -73,7 +73,11 @@ export default class MyAbility extends UIAbility {
onDestroy
()
{
onDestroy
()
{
let
applicationContext
=
globalThis
.
applicationContext
;
let
applicationContext
=
globalThis
.
applicationContext
;
applicationContext
.
unregisterEnvironmentCallback
(
callbackId
,
(
error
,
data
)
=>
{
applicationContext
.
unregisterEnvironmentCallback
(
callbackId
,
(
error
,
data
)
=>
{
console
.
log
(
'
unregisterEnvironmentCallback success, err: ${JSON.stringify(error)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
unregisterEnvironmentCallback fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}
'
);
}
});
});
}
}
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md
浏览文件 @
514c979d
...
@@ -44,7 +44,7 @@ let observerId = -1;
...
@@ -44,7 +44,7 @@ let observerId = -1;
try
{
try
{
observerId
=
errorManager
.
on
(
'
error
'
,
observer
);
observerId
=
errorManager
.
on
(
'
error
'
,
observer
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -71,13 +71,13 @@ let observerId = 100;
...
@@ -71,13 +71,13 @@ let observerId = 100;
function
unregisterErrorObserverCallback
(
err
)
{
function
unregisterErrorObserverCallback
(
err
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
------------ unregisterErrorObserverCallback ------------
'
,
err
);
console
.
error
(
'
------------ unregisterErrorObserverCallback ------------
'
,
err
);
}
}
}
}
try
{
try
{
errorManager
.
off
(
'
error
'
,
observerId
,
unregisterErrorObserverCallback
);
errorManager
.
off
(
'
error
'
,
observerId
,
unregisterErrorObserverCallback
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -112,10 +112,10 @@ try {
...
@@ -112,10 +112,10 @@ try {
console
.
log
(
'
----------- unregisterErrorObserver success ----------
'
,
data
);
console
.
log
(
'
----------- unregisterErrorObserver success ----------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
----------- unregisterErrorObserver fail ----------
'
,
err
);
console
.
error
(
'
----------- unregisterErrorObserver fail ----------
'
,
err
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md
浏览文件 @
514c979d
...
@@ -73,7 +73,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -73,7 +73,7 @@ export default class EntryAbility extends UIAbility {
});
});
}
}
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
}
}
...
@@ -84,7 +84,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -84,7 +84,7 @@ export default class EntryAbility extends UIAbility {
try
{
try
{
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
...
@@ -155,7 +155,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -155,7 +155,7 @@ export default class EntryAbility extends UIAbility {
});
});
}
}
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
}
}
...
@@ -166,7 +166,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -166,7 +166,7 @@ export default class EntryAbility extends UIAbility {
try
{
try
{
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
...
@@ -242,7 +242,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -242,7 +242,7 @@ export default class EntryAbility extends UIAbility {
});
});
}
}
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
console
.
log
(
'
[Demo] EntryAbility onDestroy
'
);
}
}
...
@@ -253,7 +253,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -253,7 +253,7 @@ export default class EntryAbility extends UIAbility {
try
{
try
{
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
...
@@ -306,7 +306,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
...
@@ -306,7 +306,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
missionManager
.
getMissionInfo
(
''
,
testMissionId
,
(
error
,
mission
)
=>
{
missionManager
.
getMissionInfo
(
''
,
testMissionId
,
(
error
,
mission
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
else
{
}
else
{
console
.
log
(
'
mission.missionId = ${mission.missionId}
'
);
console
.
log
(
'
mission.missionId = ${mission.missionId}
'
);
console
.
log
(
'
mission.runningState = ${mission.runningState}
'
);
console
.
log
(
'
mission.runningState = ${mission.runningState}
'
);
...
@@ -317,7 +317,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
...
@@ -317,7 +317,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${paramError.code}, error.message: ${paramError.message}
'
);
console
.
error
(
'
error.code: ${paramError.code}, error.message: ${paramError.message}
'
);
}
}
```
```
...
@@ -392,14 +392,14 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr
...
@@ -392,14 +392,14 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr
try
{
try
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
else
{
}
else
{
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(missions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(missions)}
'
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
浏览文件 @
514c979d
...
@@ -71,13 +71,13 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
...
@@ -71,13 +71,13 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
let
hapModuleQuickFixFiles
=
[
'
/data/storage/el2/base/entry.hqf
'
];
let
hapModuleQuickFixFiles
=
[
'
/data/storage/el2/base/entry.hqf
'
];
quickFixManager
.
applyQuickFix
(
hapModuleQuickFixFiles
,
(
error
)
=>
{
quickFixManager
.
applyQuickFix
(
hapModuleQuickFixFiles
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
info
(
`applyQuickFix failed with error:
${
error
}
`
);
console
.
error
(
`applyQuickFix failed with error:
${
error
}
`
);
}
else
{
}
else
{
console
.
info
(
'
applyQuickFix success
'
);
console
.
info
(
'
applyQuickFix success
'
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error.code: ${paramError.code}, error.message: ${paramError.message}
'
);
console
.
error
(
'
error.code: ${paramError.code}, error.message: ${paramError.message}
'
);
}
}
```
```
...
@@ -113,10 +113,10 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
...
@@ -113,10 +113,10 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
quickFixManager
.
applyQuickFix
(
hapModuleQuickFixFiles
).
then
(()
=>
{
quickFixManager
.
applyQuickFix
(
hapModuleQuickFixFiles
).
then
(()
=>
{
console
.
info
(
'
applyQuickFix success
'
);
console
.
info
(
'
applyQuickFix success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
`applyQuickFix err:
${
error
}
`
);
console
.
error
(
`applyQuickFix err:
${
error
}
`
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -146,13 +146,13 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
...
@@ -146,13 +146,13 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
let
bundleName
=
'
bundleName
'
;
let
bundleName
=
'
bundleName
'
;
quickFixManager
.
getApplicationQuickFixInfo
(
bundleName
,
(
error
,
data
)
=>
{
quickFixManager
.
getApplicationQuickFixInfo
(
bundleName
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
info
(
`getApplicationQuickFixInfo error:
${
error
}
`
);
console
.
error
(
`getApplicationQuickFixInfo error:
${
error
}
`
);
}
else
{
}
else
{
console
.
info
(
`getApplicationQuickFixInfo success:
${
data
}
`
);
console
.
info
(
`getApplicationQuickFixInfo success:
${
data
}
`
);
}
}
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
...
@@ -188,9 +188,9 @@ getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo
...
@@ -188,9 +188,9 @@ getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo
quickFixManager
.
getApplicationQuickFixInfo
(
bundleName
).
then
((
data
)
=>
{
quickFixManager
.
getApplicationQuickFixInfo
(
bundleName
).
then
((
data
)
=>
{
console
.
info
(
`getApplicationQuickFixInfo success:
${
data
}
`
);
console
.
info
(
`getApplicationQuickFixInfo success:
${
data
}
`
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
`getApplicationQuickFixInfo err:
${
error
}
`
);
console
.
error
(
`getApplicationQuickFixInfo err:
${
error
}
`
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md
浏览文件 @
514c979d
...
@@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions';
...
@@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions';
try
{
try
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -49,6 +49,6 @@ import StartOptions from '@ohos.app.ability.StartOptions';
...
@@ -49,6 +49,6 @@ import StartOptions from '@ohos.app.ability.StartOptions';
});
});
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
浏览文件 @
514c979d
...
@@ -136,7 +136,7 @@ import Want from '@ohos.app.ability.Want';
...
@@ -136,7 +136,7 @@ import Want from '@ohos.app.ability.Want';
try {
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
} catch(e) {
console.
log
('openSync fail: ${JSON.stringify(e)}');
console.
error
('openSync fail: ${JSON.stringify(e)}');
}
}
let want = {
let want = {
'deviceId': '', // deviceId为空表示本设备
'deviceId': '', // deviceId为空表示本设备
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md
浏览文件 @
514c979d
...
@@ -186,10 +186,10 @@ try {
...
@@ -186,10 +186,10 @@ try {
WantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
WantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
wantAgent
=
data
;
wantAgent
=
data
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -275,12 +275,12 @@ function getWantAgentCallback(err, data) {
...
@@ -275,12 +275,12 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//getBundleName回调
//getBundleName回调
function
getBundleNameCallback
(
err
,
data
)
{
function
getBundleNameCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
getBundleName ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getBundleName ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) {
...
@@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
getBundleName
(
wantAgent
,
getBundleNameCallback
);
WantAgent
.
getBundleName
(
wantAgent
,
getBundleNameCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -385,22 +385,22 @@ function getWantAgentCallback(err, data) {
...
@@ -385,22 +385,22 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
getBundleName
(
wantAgent
).
then
((
data
)
=>
{
WantAgent
.
getBundleName
(
wantAgent
).
then
((
data
)
=>
{
console
.
info
(
'
getBundleName ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getBundleName ok! ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) {
...
@@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) {
//getUid回调
//getUid回调
function
getUidCallback
(
err
,
data
)
{
function
getUidCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) {
...
@@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
getUid
(
wantAgent
,
getUidCallback
);
WantAgent
.
getUid
(
wantAgent
,
getUidCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -597,22 +597,22 @@ function getWantAgentCallback(err, data) {
...
@@ -597,22 +597,22 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
getUid
(
wantAgent
).
then
((
data
)
=>
{
WantAgent
.
getUid
(
wantAgent
).
then
((
data
)
=>
{
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -699,12 +699,12 @@ function getWantAgentCallback(err, data) {
...
@@ -699,12 +699,12 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//getWant回调
//getWant回调
function
getWantCallback
(
err
,
data
)
{
function
getWantCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
getWant ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getWant ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) {
...
@@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
getWant
(
wantAgent
,
getWantCallback
);
WantAgent
.
getWant
(
wantAgent
,
getWantCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -811,22 +811,22 @@ function getWantAgentCallback(err, data) {
...
@@ -811,22 +811,22 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
getUid
(
wantAgent
).
then
((
data
)
=>
{
WantAgent
.
getUid
(
wantAgent
).
then
((
data
)
=>
{
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -912,12 +912,12 @@ function getWantAgentCallback(err, data) {
...
@@ -912,12 +912,12 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//cancel回调
//cancel回调
function
cancelCallback
(
err
,
data
)
{
function
cancelCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
cancel ok!
'
);
console
.
info
(
'
cancel ok!
'
);
}
}
...
@@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) {
...
@@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
cancel
(
wantAgent
,
cancelCallback
);
WantAgent
.
cancel
(
wantAgent
,
cancelCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1022,22 +1022,22 @@ function getWantAgentCallback(err, data) {
...
@@ -1022,22 +1022,22 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
cancel
(
wantAgent
).
then
((
data
)
=>
{
WantAgent
.
cancel
(
wantAgent
).
then
((
data
)
=>
{
console
.
info
(
'
cancel ok!
'
);
console
.
info
(
'
cancel ok!
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1126,12 +1126,12 @@ function getWantAgentCallback(err, data) {
...
@@ -1126,12 +1126,12 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//trigger回调
//trigger回调
function
triggerCallback
(
err
,
data
)
{
function
triggerCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getUid ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) {
...
@@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
trigger
(
wantAgent
,
triggerInfo
,
triggerCallback
);
WantAgent
.
trigger
(
wantAgent
,
triggerInfo
,
triggerCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1234,12 +1234,12 @@ function getWantAgentCallback(err, data) {
...
@@ -1234,12 +1234,12 @@ function getWantAgentCallback(err, data) {
wantAgent1
=
data
;
wantAgent1
=
data
;
wantAgent2
=
data
;
wantAgent2
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//equal回调
//equal回调
function
equalCallback
(
err
,
data
)
{
function
equalCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
equal ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
equal ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) {
...
@@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
equal
(
wantAgent1
,
wantAgent2
,
equalCallback
);
WantAgent
.
equal
(
wantAgent1
,
wantAgent2
,
equalCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1347,22 +1347,22 @@ function getWantAgentCallback(err, data) {
...
@@ -1347,22 +1347,22 @@ function getWantAgentCallback(err, data) {
wantAgent1
=
data
;
wantAgent1
=
data
;
wantAgent2
=
data
;
wantAgent2
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
equal
(
wantAgent1
,
wantAgent2
).
then
((
data
)
=>
{
WantAgent
.
equal
(
wantAgent1
,
wantAgent2
).
then
((
data
)
=>
{
console
.
info
(
'
equal ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
equal ok! ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
})
})
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1446,12 +1446,12 @@ function getWantAgentCallback(err, data) {
...
@@ -1446,12 +1446,12 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed ${JSON.stringify(wantAgent)}
'
);
}
}
//getOperationTypeCallback回调
//getOperationTypeCallback回调
function
getOperationTypeCallback
(
err
,
data
)
{
function
getOperationTypeCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
else
{
}
else
{
console
.
info
(
'
getOperationType ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getOperationType ok! ${JSON.stringify(data)}
'
);
}
}
...
@@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) {
...
@@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) {
try
{
try
{
WantAgent
.
getOperationTypeCallback
(
wantAgent
,
getOperationTypeCallback
);
WantAgent
.
getOperationTypeCallback
(
wantAgent
,
getOperationTypeCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
@@ -1554,22 +1554,22 @@ function getWantAgentCallback(err, data) {
...
@@ -1554,22 +1554,22 @@ function getWantAgentCallback(err, data) {
if
(
err
===
undefined
)
{
if
(
err
===
undefined
)
{
wantAgent
=
data
;
wantAgent
=
data
;
}
else
{
}
else
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(wantAgent)}
'
);
}
}
try
{
try
{
WantAgent
.
getOperationType
(
wantAgent
).
then
((
data
)
=>
{
WantAgent
.
getOperationType
(
wantAgent
).
then
((
data
)
=>
{
console
.
info
(
'
getOperationType ok! ${JSON.stringify(data)}
'
);
console
.
info
(
'
getOperationType ok! ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
}
}
try
{
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}
'
);
}
}
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md
浏览文件 @
514c979d
...
@@ -59,6 +59,6 @@ try {
...
@@ -59,6 +59,6 @@ try {
};
};
formBindingData
.
createFormBindingData
(
obj
);
formBindingData
.
createFormBindingData
(
obj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md
浏览文件 @
514c979d
...
@@ -46,13 +46,13 @@ try {
...
@@ -46,13 +46,13 @@ try {
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
deleteForm
(
formId
,
(
error
)
=>
{
formHost
.
deleteForm
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost deleteForm success
'
);
console
.
log
(
'
formHost deleteForm success
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -96,10 +96,10 @@ try {
...
@@ -96,10 +96,10 @@ try {
formHost
.
deleteForm
(
formId
).
then
(()
=>
{
formHost
.
deleteForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost deleteForm success
'
);
console
.
log
(
'
formHost deleteForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -136,11 +136,11 @@ try {
...
@@ -136,11 +136,11 @@ try {
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
releaseForm
(
formId
,
(
error
)
=>
{
formHost
.
releaseForm
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -178,11 +178,11 @@ try {
...
@@ -178,11 +178,11 @@ try {
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
releaseForm
(
formId
,
true
,
(
error
)
=>
{
formHost
.
releaseForm
(
formId
,
true
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -226,10 +226,10 @@ try {
...
@@ -226,10 +226,10 @@ try {
formHost
.
releaseForm
(
formId
,
true
).
then
(()
=>
{
formHost
.
releaseForm
(
formId
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost releaseForm success
'
);
console
.
log
(
'
formHost releaseForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -266,11 +266,11 @@ try {
...
@@ -266,11 +266,11 @@ try {
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
requestForm
(
formId
,
(
error
)
=>
{
formHost
.
requestForm
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -313,10 +313,10 @@ try {
...
@@ -313,10 +313,10 @@ try {
formHost
.
requestForm
(
formId
).
then
(()
=>
{
formHost
.
requestForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost requestForm success
'
);
console
.
log
(
'
formHost requestForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -354,11 +354,11 @@ try {
...
@@ -354,11 +354,11 @@ try {
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
castToNormalForm
(
formId
,
(
error
)
=>
{
formHost
.
castToNormalForm
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -401,10 +401,10 @@ try {
...
@@ -401,10 +401,10 @@ try {
formHost
.
castToNormalForm
(
formId
).
then
(()
=>
{
formHost
.
castToNormalForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost castTempForm success
'
);
console
.
log
(
'
formHost castTempForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -441,11 +441,11 @@ try {
...
@@ -441,11 +441,11 @@ try {
let
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyVisibleForms
(
formId
,
(
error
)
=>
{
formHost
.
notifyVisibleForms
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -488,10 +488,10 @@ try {
...
@@ -488,10 +488,10 @@ try {
formHost
.
notifyVisibleForms
(
formId
).
then
(()
=>
{
formHost
.
notifyVisibleForms
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost notifyVisibleForms success
'
);
console
.
log
(
'
formHost notifyVisibleForms success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -528,11 +528,11 @@ try {
...
@@ -528,11 +528,11 @@ try {
let
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyInvisibleForms
(
formId
,
(
error
)
=>
{
formHost
.
notifyInvisibleForms
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -575,10 +575,10 @@ try {
...
@@ -575,10 +575,10 @@ try {
formHost
.
notifyInvisibleForms
(
formId
).
then
(()
=>
{
formHost
.
notifyInvisibleForms
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost notifyInvisibleForms success
'
);
console
.
log
(
'
formHost notifyInvisibleForms success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -615,11 +615,11 @@ try {
...
@@ -615,11 +615,11 @@ try {
let
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
enableFormsUpdate
(
formId
,
(
error
)
=>
{
formHost
.
enableFormsUpdate
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -662,10 +662,10 @@ try {
...
@@ -662,10 +662,10 @@ try {
formHost
.
enableFormsUpdate
(
formId
).
then
(()
=>
{
formHost
.
enableFormsUpdate
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost enableFormsUpdate success
'
);
console
.
log
(
'
formHost enableFormsUpdate success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -702,11 +702,11 @@ try {
...
@@ -702,11 +702,11 @@ try {
let
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
disableFormsUpdate
(
formId
,
(
error
)
=>
{
formHost
.
disableFormsUpdate
(
formId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -749,10 +749,10 @@ try {
...
@@ -749,10 +749,10 @@ try {
formHost
.
disableFormsUpdate
(
formId
).
then
(()
=>
{
formHost
.
disableFormsUpdate
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost disableFormsUpdate success
'
);
console
.
log
(
'
formHost disableFormsUpdate success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -778,11 +778,11 @@ import formHost from '@ohos.app.form.formHost';
...
@@ -778,11 +778,11 @@ import formHost from '@ohos.app.form.formHost';
try
{
try
{
formHost
.
isSystemReady
((
error
,
data
)
=>
{
formHost
.
isSystemReady
((
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -809,10 +809,10 @@ try {
...
@@ -809,10 +809,10 @@ try {
formHost
.
isSystemReady
().
then
(()
=>
{
formHost
.
isSystemReady
().
then
(()
=>
{
console
.
log
(
'
formHost isSystemReady success
'
);
console
.
log
(
'
formHost isSystemReady success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -840,13 +840,13 @@ import formHost from '@ohos.app.form.formHost';
...
@@ -840,13 +840,13 @@ import formHost from '@ohos.app.form.formHost';
try
{
try
{
formHost
.
getAllFormsInfo
((
error
,
data
)
=>
{
formHost
.
getAllFormsInfo
((
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost getAllFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost getAllFormsInfo, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -875,10 +875,10 @@ try {
...
@@ -875,10 +875,10 @@ try {
formHost
.
getAllFormsInfo
().
then
((
data
)
=>
{
formHost
.
getAllFormsInfo
().
then
((
data
)
=>
{
console
.
log
(
'
formHost getAllFormsInfo data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost getAllFormsInfo data: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -914,13 +914,13 @@ import formHost from '@ohos.app.form.formHost';
...
@@ -914,13 +914,13 @@ import formHost from '@ohos.app.form.formHost';
try
{
try
{
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
(
error
,
data
)
=>
{
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -957,13 +957,13 @@ import formHost from '@ohos.app.form.formHost';
...
@@ -957,13 +957,13 @@ import formHost from '@ohos.app.form.formHost';
try
{
try
{
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
'
entry
'
,
(
error
,
data
)
=>
{
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
'
entry
'
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1006,10 +1006,10 @@ try {
...
@@ -1006,10 +1006,10 @@ try {
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
'
entry
'
).
then
((
data
)
=>
{
formHost
.
getFormsInfo
(
'
com.example.ohos.formjsdemo
'
,
'
entry
'
).
then
((
data
)
=>
{
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost getFormsInfo, data: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1039,13 +1039,13 @@ try {
...
@@ -1039,13 +1039,13 @@ try {
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
deleteInvalidForms
(
formIds
,
(
error
,
data
)
=>
{
formHost
.
deleteInvalidForms
(
formIds
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost deleteInvalidForms, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost deleteInvalidForms, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1081,10 +1081,10 @@ try {
...
@@ -1081,10 +1081,10 @@ try {
formHost
.
deleteInvalidForms
(
formIds
).
then
((
data
)
=>
{
formHost
.
deleteInvalidForms
(
formIds
).
then
((
data
)
=>
{
console
.
log
(
'
formHost deleteInvalidForms, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost deleteInvalidForms, data: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1130,13 +1130,13 @@ let want = {
...
@@ -1130,13 +1130,13 @@ let want = {
try
{
try
{
formHost
.
acquireFormState
(
want
,
(
error
,
data
)
=>
{
formHost
.
acquireFormState
(
want
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
else
{
}
else
{
console
.
log
(
'
formHost acquireFormState, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost acquireFormState, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1188,10 +1188,10 @@ try {
...
@@ -1188,10 +1188,10 @@ try {
formHost
.
acquireFormState
(
want
).
then
((
data
)
=>
{
formHost
.
acquireFormState
(
want
).
then
((
data
)
=>
{
console
.
log
(
'
formHost acquireFormState, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formHost acquireFormState, data: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1281,11 +1281,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
...
@@ -1281,11 +1281,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try
{
try
{
formHost
.
notifyFormsVisible
(
formIds
,
true
,
(
error
)
=>
{
formHost
.
notifyFormsVisible
(
formIds
,
true
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1329,10 +1329,10 @@ try {
...
@@ -1329,10 +1329,10 @@ try {
formHost
.
notifyFormsVisible
(
formIds
,
true
).
then
(()
=>
{
formHost
.
notifyFormsVisible
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost notifyFormsVisible success
'
);
console
.
log
(
'
formHost notifyFormsVisible success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1370,11 +1370,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
...
@@ -1370,11 +1370,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try
{
try
{
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
,
(
error
)
=>
{
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1418,10 +1418,10 @@ try {
...
@@ -1418,10 +1418,10 @@ try {
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
).
then
(()
=>
{
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost notifyFormsEnableUpdate success
'
);
console
.
log
(
'
formHost notifyFormsEnableUpdate success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
## shareForm
## shareForm
...
@@ -1459,11 +1459,11 @@ let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
...
@@ -1459,11 +1459,11 @@ let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
try
{
try
{
formHost
.
shareForm
(
formId
,
deviceId
,
(
error
)
=>
{
formHost
.
shareForm
(
formId
,
deviceId
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1508,10 +1508,10 @@ try {
...
@@ -1508,10 +1508,10 @@ try {
formHost
.
shareForm
(
formId
,
deviceId
).
then
(()
=>
{
formHost
.
shareForm
(
formId
,
deviceId
).
then
(()
=>
{
console
.
log
(
'
formHost shareForm success
'
);
console
.
log
(
'
formHost shareForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1549,11 +1549,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
...
@@ -1549,11 +1549,11 @@ let formIds = new Array('12400633174999288', '12400633174999289');
try
{
try
{
formHost
.
notifyFormsPrivacyProtected
(
formIds
,
true
,
(
error
)
=>
{
formHost
.
notifyFormsPrivacyProtected
(
formIds
,
true
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
...
@@ -1595,10 +1595,10 @@ try {
...
@@ -1595,10 +1595,10 @@ try {
formHost
.
notifyFormsPrivacyProtected
(
formIds
,
true
).
then
(()
=>
{
formHost
.
notifyFormsPrivacyProtected
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost notifyFormsPrivacyProtected success
'
);
console
.
log
(
'
formHost notifyFormsPrivacyProtected success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md
浏览文件 @
514c979d
...
@@ -43,13 +43,13 @@ let formId = '12400633174999288';
...
@@ -43,13 +43,13 @@ let formId = '12400633174999288';
try
{
try
{
formProvider
.
setFormNextRefreshTime
(
formId
,
5
,
(
error
,
data
)
=>
{
formProvider
.
setFormNextRefreshTime
(
formId
,
5
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
`formProvider setFormNextRefreshTime success`
);
console
.
log
(
`formProvider setFormNextRefreshTime success`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -91,10 +91,10 @@ try {
...
@@ -91,10 +91,10 @@ try {
formProvider
.
setFormNextRefreshTime
(
formId
,
5
).
then
(()
=>
{
formProvider
.
setFormNextRefreshTime
(
formId
,
5
).
then
(()
=>
{
console
.
log
(
`formProvider setFormNextRefreshTime success`
);
console
.
log
(
`formProvider setFormNextRefreshTime success`
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -132,13 +132,13 @@ try {
...
@@ -132,13 +132,13 @@ try {
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
formProvider
.
updateForm
(
formId
,
obj
,
(
error
,
data
)
=>
{
formProvider
.
updateForm
(
formId
,
obj
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
`formProvider updateForm success`
);
console
.
log
(
`formProvider updateForm success`
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -182,10 +182,10 @@ try {
...
@@ -182,10 +182,10 @@ try {
formProvider
.
updateForm
(
formId
,
obj
).
then
(()
=>
{
formProvider
.
updateForm
(
formId
,
obj
).
then
(()
=>
{
console
.
log
(
`formProvider updateForm success`
);
console
.
log
(
`formProvider updateForm success`
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -219,13 +219,13 @@ import formProvider from '@ohos.app.form.formProvider';
...
@@ -219,13 +219,13 @@ import formProvider from '@ohos.app.form.formProvider';
try
{
try
{
formProvider
.
getFormsInfo
((
error
,
data
)
=>
{
formProvider
.
getFormsInfo
((
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
## getFormsInfo
## getFormsInfo
...
@@ -263,13 +263,13 @@ const filter: formInfo.FormInfoFilter = {
...
@@ -263,13 +263,13 @@ const filter: formInfo.FormInfoFilter = {
try
{
try
{
formProvider
.
getFormsInfo
(
filter
,
(
error
,
data
)
=>
{
formProvider
.
getFormsInfo
(
filter
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -314,10 +314,10 @@ try {
...
@@ -314,10 +314,10 @@ try {
formProvider
.
getFormsInfo
(
filter
).
then
((
data
)
=>
{
formProvider
.
getFormsInfo
(
filter
).
then
((
data
)
=>
{
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider getFormsInfo, data: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -364,13 +364,13 @@ try {
...
@@ -364,13 +364,13 @@ try {
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
formProvider
.
requestPublishForm
(
want
,
obj
,
(
error
,
data
)
=>
{
formProvider
.
requestPublishForm
(
want
,
obj
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -414,13 +414,13 @@ let want = {
...
@@ -414,13 +414,13 @@ let want = {
try
{
try
{
formProvider
.
requestPublishForm
(
want
,
(
error
,
data
)
=>
{
formProvider
.
requestPublishForm
(
want
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -471,10 +471,10 @@ try {
...
@@ -471,10 +471,10 @@ try {
formProvider
.
requestPublishForm
(
want
).
then
((
data
)
=>
{
formProvider
.
requestPublishForm
(
want
).
then
((
data
)
=>
{
console
.
log
(
'
formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -502,7 +502,7 @@ import formProvider from '@ohos.app.form.formProvider';
...
@@ -502,7 +502,7 @@ import formProvider from '@ohos.app.form.formProvider';
try
{
try
{
formProvider
.
isRequestPublishFormSupported
((
error
,
isSupported
)
=>
{
formProvider
.
isRequestPublishFormSupported
((
error
,
isSupported
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
if
(
isSupported
)
{
if
(
isSupported
)
{
var
want
=
{
var
want
=
{
...
@@ -516,19 +516,19 @@ try {
...
@@ -516,19 +516,19 @@ try {
try
{
try
{
formProvider
.
requestPublishForm
(
want
,
(
error
,
data
)
=>
{
formProvider
.
requestPublishForm
(
want
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`callback error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
else
{
}
else
{
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}
'
);
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
}
}
}
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
...
@@ -568,16 +568,16 @@ try {
...
@@ -568,16 +568,16 @@ try {
formProvider
.
requestPublishForm
(
want
).
then
((
data
)
=>
{
formProvider
.
requestPublishForm
(
want
).
then
((
data
)
=>
{
console
.
log
(
'
formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}
'
);
console
.
log
(
'
formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
}
}
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`promise error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
)`
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md
浏览文件 @
514c979d
...
@@ -90,7 +90,7 @@ let config = {
...
@@ -90,7 +90,7 @@ let config = {
abilityManager
.
updateConfiguration
(
config
).
then
(()
=>
{
abilityManager
.
updateConfiguration
(
config
).
then
(()
=>
{
console
.
log
(
'
updateConfiguration success
'
);
console
.
log
(
'
updateConfiguration success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
updateConfiguration fail
'
);
console
.
error
(
'
updateConfiguration fail
'
);
});
});
```
```
...
@@ -140,6 +140,6 @@ getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>
...
@@ -140,6 +140,6 @@ getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>
abilityManager
.
getAbilityRunningInfos
().
then
((
data
)
=>
{
abilityManager
.
getAbilityRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
'
getAbilityRunningInfos data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
getAbilityRunningInfos data: ${JSON.stringify(data)}
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getAbilityRunningInfos err: ${JSON.stringify(err)}
'
);
console
.
error
(
'
getAbilityRunningInfos err: ${JSON.stringify(err)}
'
);
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-application-appManager.md
浏览文件 @
514c979d
...
@@ -29,9 +29,12 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void
...
@@ -29,9 +29,12 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void
**示例:**
**示例:**
```
ts
```
ts
appManager
.
isRunningInStabilityTest
((
err
,
flag
)
=>
{
appManager
.
isRunningInStabilityTest
((
error
,
flag
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
console
.
error
(
'
isRunningInStabilityTest fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
isRunningInStabilityTest success, the result is: ${JSON.stringify(flag)}
'
);
}
});
});
```
```
...
@@ -56,7 +59,7 @@ static isRunningInStabilityTest(): Promise<boolean>
...
@@ -56,7 +59,7 @@ static isRunningInStabilityTest(): Promise<boolean>
appManager
.
isRunningInStabilityTest
().
then
((
flag
)
=>
{
appManager
.
isRunningInStabilityTest
().
then
((
flag
)
=>
{
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
console
.
log
(
'
The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -81,7 +84,7 @@ isRamConstrainedDevice(): Promise\<boolean>;
...
@@ -81,7 +84,7 @@ isRamConstrainedDevice(): Promise\<boolean>;
appManager
.
isRamConstrainedDevice
().
then
((
data
)
=>
{
appManager
.
isRamConstrainedDevice
().
then
((
data
)
=>
{
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -102,9 +105,12 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
...
@@ -102,9 +105,12 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
**示例:**
**示例:**
```
ts
```
ts
appManager
.
isRamConstrainedDevice
((
err
,
data
)
=>
{
appManager
.
isRamConstrainedDevice
((
error
,
data
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
console
.
error
(
'
isRamConstrainedDevice fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
The result of isRamConstrainedDevice is: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -128,7 +134,7 @@ getAppMemorySize(): Promise\<number>;
...
@@ -128,7 +134,7 @@ getAppMemorySize(): Promise\<number>;
appManager
.
getAppMemorySize
().
then
((
data
)
=>
{
appManager
.
getAppMemorySize
().
then
((
data
)
=>
{
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -149,9 +155,12 @@ getAppMemorySize(callback: AsyncCallback\<number>): void;
...
@@ -149,9 +155,12 @@ getAppMemorySize(callback: AsyncCallback\<number>): void;
**示例:**
**示例:**
```
ts
```
ts
appManager
.
getAppMemorySize
((
err
,
data
)
=>
{
appManager
.
getAppMemorySize
((
error
,
data
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
console
.
error
(
'
getAppMemorySize fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
The size of app memory is: ${JSON.stringify(data)}
'
);
}
});
});
```
```
## appManager.getProcessRunningInfos<sup>(deprecated)</sup>
## appManager.getProcessRunningInfos<sup>(deprecated)</sup>
...
@@ -178,7 +187,7 @@ getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;
...
@@ -178,7 +187,7 @@ getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;
appManager
.
getProcessRunningInfos
().
then
((
data
)
=>
{
appManager
.
getProcessRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
'
The process running infos is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The process running infos is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -203,9 +212,12 @@ getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): vo
...
@@ -203,9 +212,12 @@ getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): vo
**示例:**
**示例:**
```
ts
```
ts
appManager
.
getProcessRunningInfos
((
err
,
data
)
=>
{
appManager
.
getProcessRunningInfos
((
error
,
data
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
The process running infos is: ${JSON.stringify(data)}
'
);
console
.
error
(
'
getProcessRunningInfos fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getProcessRunningInfos success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -320,7 +332,7 @@ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\
...
@@ -320,7 +332,7 @@ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\
function
unregisterApplicationStateObserverCallback
(
err
)
{
function
unregisterApplicationStateObserverCallback
(
err
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
------------ unregisterApplicationStateObserverCallback ------------
'
,
err
);
console
.
error
(
'
------------ unregisterApplicationStateObserverCallback ------------
'
,
err
);
}
}
}
}
appManager
.
unregisterApplicationStateObserver
(
observerId
,
unregisterApplicationStateObserverCallback
);
appManager
.
unregisterApplicationStateObserver
(
observerId
,
unregisterApplicationStateObserverCallback
);
...
@@ -360,7 +372,7 @@ unregisterApplicationStateObserver(observerId: number): Promise\<void>;
...
@@ -360,7 +372,7 @@ unregisterApplicationStateObserver(observerId: number): Promise\<void>;
console
.
log
(
'
----------- unregisterApplicationStateObserver success ----------
'
,
data
);
console
.
log
(
'
----------- unregisterApplicationStateObserver success ----------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
----------- unregisterApplicationStateObserver fail ----------
'
,
err
);
console
.
error
(
'
----------- unregisterApplicationStateObserver fail ----------
'
,
err
);
});
});
```
```
...
@@ -387,7 +399,7 @@ getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
...
@@ -387,7 +399,7 @@ getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
```
ts
```
ts
function
getForegroundApplicationsCallback
(
err
,
data
)
{
function
getForegroundApplicationsCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
--------- getForegroundApplicationsCallback fail ---------
'
,
err
);
console
.
error
(
'
--------- getForegroundApplicationsCallback fail ---------
'
,
err
);
}
else
{
}
else
{
console
.
log
(
'
--------- getForegroundApplicationsCallback success ---------
'
,
data
);
console
.
log
(
'
--------- getForegroundApplicationsCallback success ---------
'
,
data
);
}
}
...
@@ -421,7 +433,7 @@ getForegroundApplications(): Promise\<Array\<AppStateData>>;
...
@@ -421,7 +433,7 @@ getForegroundApplications(): Promise\<Array\<AppStateData>>;
console
.
log
(
'
--------- getForegroundApplications success -------
'
,
data
);
console
.
log
(
'
--------- getForegroundApplications success -------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
--------- getForegroundApplications fail -------
'
,
err
);
console
.
error
(
'
--------- getForegroundApplications fail -------
'
,
err
);
});
});
```
```
...
@@ -454,7 +466,7 @@ appManager.killProcessWithAccount(bundleName, accountId)
...
@@ -454,7 +466,7 @@ appManager.killProcessWithAccount(bundleName, accountId)
console
.
log
(
'
------------ killProcessWithAccount success ------------
'
,
data
);
console
.
log
(
'
------------ killProcessWithAccount success ------------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
------------ killProcessWithAccount fail ------------
'
,
err
);
console
.
error
(
'
------------ killProcessWithAccount fail ------------
'
,
err
);
});
});
```
```
...
@@ -486,7 +498,7 @@ let bundleName = 'bundleName';
...
@@ -486,7 +498,7 @@ let bundleName = 'bundleName';
let
accountId
=
0
;
let
accountId
=
0
;
function
killProcessWithAccountCallback
(
err
,
data
)
{
function
killProcessWithAccountCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
------------- killProcessWithAccountCallback fail, err: --------------
'
,
err
);
console
.
error
(
'
------------- killProcessWithAccountCallback fail, err: --------------
'
,
err
);
}
else
{
}
else
{
console
.
log
(
'
------------- killProcessWithAccountCallback success, data: --------------
'
,
data
);
console
.
log
(
'
------------- killProcessWithAccountCallback success, data: --------------
'
,
data
);
}
}
...
@@ -519,7 +531,7 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);
...
@@ -519,7 +531,7 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);
let
bundleName
=
'
bundleName
'
;
let
bundleName
=
'
bundleName
'
;
function
killProcessesByBundleNameCallback
(
err
,
data
)
{
function
killProcessesByBundleNameCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
------------- killProcessesByBundleNameCallback fail, err: --------------
'
,
err
);
console
.
error
(
'
------------- killProcessesByBundleNameCallback fail, err: --------------
'
,
err
);
}
else
{
}
else
{
console
.
log
(
'
------------- killProcessesByBundleNameCallback success, data: --------------
'
,
data
);
console
.
log
(
'
------------- killProcessesByBundleNameCallback success, data: --------------
'
,
data
);
}
}
...
@@ -560,7 +572,7 @@ killProcessesByBundleName(bundleName: string): Promise\<void>;
...
@@ -560,7 +572,7 @@ killProcessesByBundleName(bundleName: string): Promise\<void>;
console
.
log
(
'
------------ killProcessesByBundleName success ------------
'
,
data
);
console
.
log
(
'
------------ killProcessesByBundleName success ------------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
------------ killProcessesByBundleName fail ------------
'
,
err
);
console
.
error
(
'
------------ killProcessesByBundleName fail ------------
'
,
err
);
});
});
```
```
...
@@ -589,7 +601,7 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);
...
@@ -589,7 +601,7 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);
let
bundleName
=
'
bundleName
'
;
let
bundleName
=
'
bundleName
'
;
function
clearUpApplicationDataCallback
(
err
,
data
)
{
function
clearUpApplicationDataCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
------------- clearUpApplicationDataCallback fail, err: --------------
'
,
err
);
console
.
error
(
'
------------- clearUpApplicationDataCallback fail, err: --------------
'
,
err
);
}
else
{
}
else
{
console
.
log
(
'
------------- clearUpApplicationDataCallback success, data: --------------
'
,
data
);
console
.
log
(
'
------------- clearUpApplicationDataCallback success, data: --------------
'
,
data
);
}
}
...
@@ -630,6 +642,6 @@ clearUpApplicationData(bundleName: string): Promise\<void>;
...
@@ -630,6 +642,6 @@ clearUpApplicationData(bundleName: string): Promise\<void>;
console
.
log
(
'
------------ clearUpApplicationData success ------------
'
,
data
);
console
.
log
(
'
------------ clearUpApplicationData success ------------
'
,
data
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
'
------------ clearUpApplicationData fail ------------
'
,
err
);
console
.
error
(
'
------------ clearUpApplicationData fail ------------
'
,
err
);
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
浏览文件 @
514c979d
...
@@ -81,7 +81,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
...
@@ -81,7 +81,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
console
.
log
(
'
getRdbStore done, data : ${data}
'
);
console
.
log
(
'
getRdbStore done, data : ${data}
'
);
rdbStore
=
data
;
rdbStore
=
data
;
rdbStore
.
executeSql
(
DDL_TBL_CREATE
,
[],
function
(
err
)
{
rdbStore
.
executeSql
(
DDL_TBL_CREATE
,
[],
function
(
err
)
{
console
.
log
(
'
executeSql done, error message : ${err}
'
);
console
.
error
(
'
executeSql done, error message : ${err}
'
);
});
});
if
(
callback
)
{
if
(
callback
)
{
callback
();
callback
();
...
...
zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md
浏览文件 @
514c979d
...
@@ -54,7 +54,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -54,7 +54,7 @@ export default class EntryAbility extends UIAbility {
onCreate
()
{
onCreate
()
{
console
.
log
(
'
MyAbility onCreate
'
);
console
.
log
(
'
MyAbility onCreate
'
);
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
let
E
nvironmentCallback
=
{
let
e
nvironmentCallback
=
{
onConfigurationUpdated
(
config
){
onConfigurationUpdated
(
config
){
console
.
log
(
'
onConfigurationUpdated config: ${JSON.stringify(config)}
'
);
console
.
log
(
'
onConfigurationUpdated config: ${JSON.stringify(config)}
'
);
},
},
...
@@ -65,13 +65,17 @@ export default class EntryAbility extends UIAbility {
...
@@ -65,13 +65,17 @@ export default class EntryAbility extends UIAbility {
// 1.获取applicationContext
// 1.获取applicationContext
let
applicationContext
=
globalThis
.
applicationContext
;
let
applicationContext
=
globalThis
.
applicationContext
;
// 2.通过applicationContext注册监听应用内生命周期
// 2.通过applicationContext注册监听应用内生命周期
callbackId
=
applicationContext
.
registerEnvironmentCallback
(
E
nvironmentCallback
);
callbackId
=
applicationContext
.
registerEnvironmentCallback
(
e
nvironmentCallback
);
console
.
log
(
'
registerEnvironmentCallback number: ${JSON.stringify(callbackId)}
'
);
console
.
log
(
'
registerEnvironmentCallback number: ${JSON.stringify(callbackId)}
'
);
}
}
onDestroy
()
{
onDestroy
()
{
let
applicationContext
=
globalThis
.
applicationContext
;
let
applicationContext
=
globalThis
.
applicationContext
;
applicationContext
.
unregisterEnvironmentCallback
(
callbackId
,
(
error
,
data
)
=>
{
applicationContext
.
unregisterEnvironmentCallback
(
callbackId
,
(
error
,
data
)
=>
{
console
.
log
(
'
unregisterEnvironmentCallback success, err: ${JSON.stringify(error)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
unregisterEnvironmentCallback fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}
'
);
}
});
});
}
}
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-application-formBindingData.md
浏览文件 @
514c979d
...
@@ -59,6 +59,6 @@ try {
...
@@ -59,6 +59,6 @@ try {
};
};
formBindingData
.
createFormBindingData
(
obj
);
formBindingData
.
createFormBindingData
(
obj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
catch error, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
catch error, error: ${JSON.stringify(error)}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-application-formProvider.md
浏览文件 @
514c979d
...
@@ -36,7 +36,7 @@ setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback&l
...
@@ -36,7 +36,7 @@ setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback&l
let
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formProvider
.
setFormNextRefreshTime
(
formId
,
5
,
(
error
,
data
)
=>
{
formProvider
.
setFormNextRefreshTime
(
formId
,
5
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}
'
);
}
}
});
});
```
```
...
@@ -71,7 +71,7 @@ setFormNextRefreshTime(formId: string, minute: number): Promise<void>
...
@@ -71,7 +71,7 @@ setFormNextRefreshTime(formId: string, minute: number): Promise<void>
formProvider
.
setFormNextRefreshTime
(
formId
,
5
).
then
(()
=>
{
formProvider
.
setFormNextRefreshTime
(
formId
,
5
).
then
(()
=>
{
console
.
log
(
'
formProvider setFormNextRefreshTime success
'
);
console
.
log
(
'
formProvider setFormNextRefreshTime success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -101,7 +101,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData,call
...
@@ -101,7 +101,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData,call
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
formProvider
.
updateForm
(
formId
,
obj
,
(
error
,
data
)
=>
{
formProvider
.
updateForm
(
formId
,
obj
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
formProvider updateForm, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
formProvider updateForm, error: ${JSON.stringify(error)}
'
);
}
}
});
});
```
```
...
@@ -138,7 +138,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Pr
...
@@ -138,7 +138,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Pr
formProvider
.
updateForm
(
formId
,
obj
).
then
(()
=>
{
formProvider
.
updateForm
(
formId
,
obj
).
then
(()
=>
{
console
.
log
(
'
formProvider updateForm success
'
);
console
.
log
(
'
formProvider updateForm success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
formProvider updateForm, error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
formProvider updateForm, error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md
浏览文件 @
514c979d
...
@@ -92,7 +92,7 @@ unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>
...
@@ -92,7 +92,7 @@ unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
missionManager
.
unregisterMissionListener
(
listenerid
,
(
error
)
=>
{
missionManager
.
unregisterMissionListener
(
listenerid
,
(
error
)
=>
{
console
.
log
(
'
unregisterMissionListener
'
);
console
.
error
(
'
unregisterMissionListener fail, error: ${error}
'
);
});
});
```
```
...
@@ -136,8 +136,8 @@ unregisterMissionListener(listenerId: number): Promise<void>;
...
@@ -136,8 +136,8 @@ unregisterMissionListener(listenerId: number): Promise<void>;
console
.
log
(
'
registerMissionListener
'
);
console
.
log
(
'
registerMissionListener
'
);
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
missionManager
.
unregisterMissionListener
(
listenerid
).
catch
(
function
(
err
)
{
missionManager
.
unregisterMissionListener
(
listenerid
).
catch
(
function
(
err
or
)
{
console
.
log
(
err
);
console
.
error
(
'
unregisterMissionListener fail, error: ${error}
'
);
});
});
```
```
...
@@ -170,7 +170,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
...
@@ -170,7 +170,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
){
console
.
log
(
err
);});
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
){
console
.
log
(
err
);});
missionManager
.
getMissionInfo
(
''
,
allMissions
[
0
].
missionId
,
(
error
,
mission
)
=>
{
missionManager
.
getMissionInfo
(
''
,
allMissions
[
0
].
missionId
,
(
error
,
mission
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
...
@@ -214,8 +214,8 @@ getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
...
@@ -214,8 +214,8 @@ getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
```
ts
```
ts
import
missionManager
from
'
@ohos.application.missionManager
'
;
import
missionManager
from
'
@ohos.application.missionManager
'
;
let
mission
=
missionManager
.
getMissionInfo
(
''
,
10
).
catch
(
function
(
err
){
let
mission
=
missionManager
.
getMissionInfo
(
''
,
10
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
getMissionInfo fail, error: ${error}
'
);
});
});
```
```
...
@@ -247,7 +247,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr
...
@@ -247,7 +247,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -286,8 +286,8 @@ getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionIn
...
@@ -286,8 +286,8 @@ getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionIn
```
ts
```
ts
import
missionManager
from
'
@ohos.application.missionManager
'
;
import
missionManager
from
'
@ohos.application.missionManager
'
;
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
){
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
});
```
```
...
@@ -319,7 +319,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
...
@@ -319,7 +319,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -328,7 +328,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
...
@@ -328,7 +328,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
missionManager
.
getMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
missionManager
.
getMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
bundleName = ${snapshot.ability.bundleName}
'
);
console
.
log
(
'
bundleName = ${snapshot.ability.bundleName}
'
);
...
@@ -370,13 +370,15 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps
...
@@ -370,13 +370,15 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
let
snapshot
=
missionManager
.
getMissionSnapShot
(
''
,
id
).
catch
(
function
(
err
){
let
snapshot
=
missionManager
.
getMissionSnapShot
(
''
,
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
getMissionSnapShot fail, error: ${error}
'
);
});
});
```
```
...
@@ -407,7 +409,7 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
...
@@ -407,7 +409,7 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -416,8 +418,7 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
...
@@ -416,8 +418,7 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
missionManager
.
getLowResolutionMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
missionManager
.
getLowResolutionMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}
console
.
error
(
'
getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
'
error
.
message
:
$
{
JSON
.
stringify
(
error
.
message
)}
'
);
return
;
return
;
}
}
console
.
log
(
'
bundleName = ${snapshot.ability.bundleName}
'
);
console
.
log
(
'
bundleName = ${snapshot.ability.bundleName}
'
);
...
@@ -459,13 +460,15 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\<M
...
@@ -459,13 +460,15 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\<M
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
let
snapshot
=
missionManager
.
getLowResolutionMissionSnapShot
(
''
,
id
).
catch
(
function
(
err
){
let
snapshot
=
missionManager
.
getLowResolutionMissionSnapShot
(
''
,
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
getLowResolutionMissionSnapShot fail, error: ${error}
'
);
});
});
```
```
...
@@ -496,8 +499,7 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void;
...
@@ -496,8 +499,7 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void;
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
'
error
.
message
:
$
{
JSON
.
stringify
(
error
.
message
)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -542,13 +544,15 @@ lockMission(missionId: number): Promise<void>;
...
@@ -542,13 +544,15 @@ lockMission(missionId: number): Promise<void>;
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
missionManager
.
lockMission
(
id
).
catch
(
function
(
err
){
missionManager
.
lockMission
(
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
lockMission fail, error: ${error}
'
);
});
});
```
```
...
@@ -579,7 +583,7 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void;
...
@@ -579,7 +583,7 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void;
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -625,16 +629,18 @@ unlockMission(missionId: number): Promise<void>;
...
@@ -625,16 +629,18 @@ unlockMission(missionId: number): Promise<void>;
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
missionManager
.
lockMission
(
id
).
catch
(
function
(
err
){
missionManager
.
lockMission
(
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
lockMission fail, error: ${error}
'
);
});
});
missionManager
.
unlockMission
(
id
).
catch
(
function
(
err
){
missionManager
.
unlockMission
(
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
unlockMission fail, error: ${error}
'
);
});
});
```
```
...
@@ -665,7 +671,7 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void;
...
@@ -665,7 +671,7 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void;
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -711,13 +717,15 @@ clearMission(missionId: number): Promise<void>;
...
@@ -711,13 +717,15 @@ clearMission(missionId: number): Promise<void>;
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
missionManager
.
clearMission
(
id
).
catch
(
function
(
err
){
missionManager
.
clearMission
(
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
clearMission fail, error: ${error}
'
);
});
});
```
```
...
@@ -767,8 +775,8 @@ clearAllMissions(): Promise<void>;
...
@@ -767,8 +775,8 @@ clearAllMissions(): Promise<void>;
```
ts
```
ts
import
missionManager
from
'
@ohos.application.missionManager
'
;
import
missionManager
from
'
@ohos.application.missionManager
'
;
missionManager
.
clearAllMissions
().
catch
(
function
(
err
){
missionManager
.
clearAllMissions
().
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
clearAllMissions fail, error: ${error}
'
);
});
});
```
```
...
@@ -799,7 +807,7 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void
...
@@ -799,7 +807,7 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -840,7 +848,7 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall
...
@@ -840,7 +848,7 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -887,12 +895,14 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise<void&g
...
@@ -887,12 +895,14 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise<void&g
let
allMissions
;
let
allMissions
;
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
missionManager
.
getMissionInfos
(
''
,
10
).
then
(
function
(
res
){
allMissions
=
res
;
allMissions
=
res
;
}).
catch
(
function
(
err
){
console
.
log
(
err
);});
}).
catch
(
function
(
error
)
{
console
.
error
(
'
getMissionInfos fail, error: ${error}
'
);
});
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
size = ${allMissions.length}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
console
.
log
(
'
missions = ${JSON.stringify(allMissions)}
'
);
let
id
=
allMissions
[
0
].
missionId
;
let
id
=
allMissions
[
0
].
missionId
;
missionManager
.
moveMissionToFront
(
id
).
catch
(
function
(
err
){
missionManager
.
moveMissionToFront
(
id
).
catch
(
function
(
err
or
){
console
.
log
(
err
);
console
.
error
(
'
moveMissionToFront fail, error: ${error}
'
);
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-application-want.md
浏览文件 @
514c979d
...
@@ -42,7 +42,7 @@ import Want from '@ohos.application.Want';
...
@@ -42,7 +42,7 @@ import Want from '@ohos.application.Want';
};
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
'
error.code = ${error.code}
'
);
console
.
error
(
'
error.code = ${error.code}
'
);
});
});
```
```
...
@@ -114,7 +114,7 @@ import Want from '@ohos.application.Want';
...
@@ -114,7 +114,7 @@ import Want from '@ohos.application.Want';
try {
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
} catch(e) {
console.
log
('openSync fail: ${JSON.stringify(e)}');
console.
error
('openSync fail: ${JSON.stringify(e)}');
}
}
let want = {
let want = {
'deviceId': '', // deviceId为空表示本设备
'deviceId': '', // deviceId为空表示本设备
...
@@ -127,7 +127,7 @@ import Want from '@ohos.application.Want';
...
@@ -127,7 +127,7 @@ import Want from '@ohos.application.Want';
};
};
this.context.startAbility(want, (error) => {
this.context.startAbility(want, (error) => {
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console.
log
('error.code = ${error.code}');
console.
error
('error.code = ${error.code}');
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md
浏览文件 @
514c979d
...
@@ -39,8 +39,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -39,8 +39,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
let
mode
=
'
rw
'
;
let
mode
=
'
rw
'
;
DAHelper
.
openFile
(
'
dataability:///com.example.DataAbility
'
,
mode
,
(
err
,
data
)
=>
{
DAHelper
.
openFile
(
'
dataability:///com.example.DataAbility
'
,
mode
,
(
error
,
data
)
=>
{
console
.
info
(
'
openFile err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
openFile fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
openFile success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -170,8 +174,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -170,8 +174,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
DAHelper
.
getType
(
'
dataability:///com.example.DataAbility
'
,
(
err
,
data
)
=>
{
DAHelper
.
getType
(
'
dataability:///com.example.DataAbility
'
,
(
error
,
data
)
=>
{
console
.
info
(
'
getType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getType fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getType success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -230,8 +238,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -230,8 +238,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
DAHelper
.
getFileTypes
(
'
dataability:///com.example.DataAbility
'
,
'
image/*
'
,
(
err
,
data
)
=>
{
DAHelper
.
getFileTypes
(
'
dataability:///com.example.DataAbility
'
,
'
image/*
'
,
(
error
,
data
)
=>
{
console
.
info
(
'
getFileTypes err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getFileTypes fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getFileTypes success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -290,8 +302,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -290,8 +302,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
DAHelper
.
normalizeUri
(
'
dataability:///com.example.DataAbility
'
,
(
err
,
data
)
=>
{
DAHelper
.
normalizeUri
(
'
dataability:///com.example.DataAbility
'
,
(
error
,
data
)
=>
{
console
.
info
(
'
normalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
normalizeUri fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
normalizeUri success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -349,8 +365,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -349,8 +365,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
DAHelper
.
denormalizeUri
(
'
dataability:///com.example.DataAbility
'
,
(
err
,
data
)
=>
{
DAHelper
.
denormalizeUri
(
'
dataability:///com.example.DataAbility
'
,
(
error
,
data
)
=>
{
console
.
info
(
'
denormalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
denormalizeUri fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
denormalizeUri success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -408,8 +428,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -408,8 +428,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
DAHelper
.
notifyChange
(
'
dataability:///com.example.DataAbility
'
,
(
err
)
=>
{
DAHelper
.
notifyChange
(
'
dataability:///com.example.DataAbility
'
,
(
error
)
=>
{
console
.
info
(
'
==========================>Called=======================>
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
notifyChange fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
notifyChange success
'
);
}
});
});
```
```
...
@@ -474,8 +498,12 @@ const valueBucket = {
...
@@ -474,8 +498,12 @@ const valueBucket = {
'
salary
'
:
200.5
,
'
salary
'
:
200.5
,
'
blobType
'
:
'
u8
'
,
'
blobType
'
:
'
u8
'
,
};
};
DAHelper
.
insert
(
'
dataability:///com.example.DataAbility
'
,
valueBucket
,
(
err
,
data
)
=>
{
DAHelper
.
insert
(
'
dataability:///com.example.DataAbility
'
,
valueBucket
,
(
error
,
data
)
=>
{
console
.
info
(
'
insert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
insert fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
insert success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -544,8 +572,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -544,8 +572,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
let
cars
=
new
Array
({
'
name
'
:
'
roe11
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,},
let
cars
=
new
Array
({
'
name
'
:
'
roe11
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,},
{
'
name
'
:
'
roe12
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,},
{
'
name
'
:
'
roe12
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,},
{
'
name
'
:
'
roe13
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,});
{
'
name
'
:
'
roe13
'
,
'
age
'
:
21
,
'
salary
'
:
20.5
,
'
blobType
'
:
'
u8
'
,});
DAHelper
.
batchInsert
(
'
dataability:///com.example.DataAbility
'
,
cars
,
(
err
,
data
)
=>
{
DAHelper
.
batchInsert
(
'
dataability:///com.example.DataAbility
'
,
cars
,
(
error
,
data
)
=>
{
console
.
info
(
'
batchInsert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
batchInsert fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
batchInsert success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -610,8 +642,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -610,8 +642,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
'
dataability:///com.example.DataAbility
'
'
dataability:///com.example.DataAbility
'
);
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
DAHelper
.
delete
(
'
dataability:///com.example.DataAbility
'
,
da
,
(
err
,
data
)
=>
{
DAHelper
.
delete
(
'
dataability:///com.example.DataAbility
'
,
da
,
(
error
,
data
)
=>
{
console
.
info
(
'
delete err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
delete fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
delete success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -682,8 +718,12 @@ const va = {
...
@@ -682,8 +718,12 @@ const va = {
'
blobType
'
:
'
u8
'
,
'
blobType
'
:
'
u8
'
,
};
};
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
DAHelper
.
update
(
'
dataability:///com.example.DataAbility
'
,
va
,
da
,
(
err
,
data
)
=>
{
DAHelper
.
update
(
'
dataability:///com.example.DataAbility
'
,
va
,
da
,
(
error
,
data
)
=>
{
console
.
info
(
'
update err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
update fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
update success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -756,8 +796,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -756,8 +796,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper(
);
);
let
cars
=
new
Array
(
'
value1
'
,
'
value2
'
,
'
value3
'
,
'
value4
'
);
let
cars
=
new
Array
(
'
value1
'
,
'
value2
'
,
'
value3
'
,
'
value4
'
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
();
DAHelper
.
query
(
'
dataability:///com.example.DataAbility
'
,
cars
,
da
,
(
err
,
data
)
=>
{
DAHelper
.
query
(
'
dataability:///com.example.DataAbility
'
,
cars
,
da
,
(
error
,
data
)
=>
{
console
.
info
(
'
query err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
query fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
query success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -827,12 +871,12 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -827,12 +871,12 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
'
dataability:///com.example.jsapidemo.UserDataAbility
'
);
);
dataAbilityHelper
.
call
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
dataAbilityHelper
.
call
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
'
method
'
,
'
arg
'
,
{
'
key1
'
:
'
value1
'
},
(
err
,
data
)
=>
{
'
method
'
,
'
arg
'
,
{
'
key1
'
:
'
value1
'
},
(
error
,
data
)
=>
{
if
(
err
)
{
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
Operation failed. Cause: ${err}
'
);
console
.
error
(
'
call fail, error: ${JSON.stringify(error)}
'
);
return
;
}
else
{
console
.
log
(
'
call success, data: ${JSON.stringify(data)}
'
);
}
}
console
.
info
(
'
Operation succeeded: ${data}
'
);
});
});
```
```
...
@@ -869,9 +913,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -869,9 +913,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
);
);
dataAbilityHelper
.
call
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
dataAbilityHelper
.
call
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
'
method
'
,
'
arg
'
,
{
'
key1
'
:
'
value1
'
}).
then
((
data
)
=>
{
'
method
'
,
'
arg
'
,
{
'
key1
'
:
'
value1
'
}).
then
((
data
)
=>
{
console
.
info
(
'
Operation succeeded
: ${data}
'
);
console
.
info
(
'
call success, data
: ${data}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause
: ${error}
'
);
console
.
error
(
'
call failed, error
: ${error}
'
);
});
});
```
```
...
@@ -901,12 +945,12 @@ let op=new Array();
...
@@ -901,12 +945,12 @@ let op=new Array();
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
'
dataability:///com.example.jsapidemo.UserDataAbility
'
);
);
dataAbilityHelper
.
executeBatch
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
op
,
(
err
,
data
)
=>
{
dataAbilityHelper
.
executeBatch
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
op
,
(
error
,
data
)
=>
{
if
(
err
)
{
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
Operation failed. Cause: ${err}
'
);
console
.
error
(
'
executeBatch fail, error: ${JSON.stringify(error)}
'
);
return
;
}
else
{
console
.
log
(
'
executeBatch success, data: ${JSON.stringify(data)}
'
);
}
}
console
.
info
(
'
Operation succeeded: ${data}
'
);
});
});
```
```
...
@@ -942,9 +986,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
...
@@ -942,9 +986,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
'
dataability:///com.example.jsapidemo.UserDataAbility
'
);
);
dataAbilityHelper
.
executeBatch
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
op
).
then
((
data
)
=>
{
dataAbilityHelper
.
executeBatch
(
'
dataability:///com.example.jsapidemo.UserDataAbility
'
,
op
).
then
((
data
)
=>
{
console
.
info
(
'
Operation succeeded
: ${data}
'
);
console
.
info
(
'
executeBatch success, data
: ${data}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause
: ${error}
'
);
console
.
error
(
'
executeBatch failed, error
: ${error}
'
);
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md
浏览文件 @
514c979d
...
@@ -36,11 +36,14 @@ let startAbilityParameter = {
...
@@ -36,11 +36,14 @@ let startAbilityParameter = {
};
};
try
{
try
{
featureAbility
.
startAbility
(
startAbilityParameter
,
(
err
,
data
)
=>
{
featureAbility
.
startAbility
(
startAbilityParameter
,
(
error
,
data
)
=>
{
console
.
log
(
'
errCode : ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
log
(
'
data : ${JSON.stringify(data)}
'
);
console
.
error
(
'
startAbility fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
startAbility success, data: ${JSON.stringify(data)}
'
);
}
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
startAbility error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
startAbility error: ${JSON.stringify(error)}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
浏览文件 @
514c979d
...
@@ -34,7 +34,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
...
@@ -34,7 +34,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
};
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
'
error.code = ${error.code}
'
);
console
.
error
(
'
error.code = ${error.code}
'
);
});
});
```
```
...
@@ -48,7 +48,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
...
@@ -48,7 +48,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
try
{
try
{
fd
=
fileio
.
openSync
(
'
/data/storage/el2/base/haps/pic.png
'
);
fd
=
fileio
.
openSync
(
'
/data/storage/el2/base/haps/pic.png
'
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
openSync fail: ${JSON.stringify(e)}
'
);
console
.
error
(
'
openSync fail: ${JSON.stringify(e)}
'
);
}
}
let
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
// deviceId为空表示本设备
'
deviceId
'
:
''
,
// deviceId为空表示本设备
...
@@ -61,7 +61,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
...
@@ -61,7 +61,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
};
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
'
error.code = ${error.code}
'
);
console
.
error
(
'
error.code = ${error.code}
'
);
});
});
// ...
// ...
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md
浏览文件 @
514c979d
...
@@ -40,8 +40,12 @@ getOrCreateLocalDir(callback: AsyncCallback\<string>): void
...
@@ -40,8 +40,12 @@ getOrCreateLocalDir(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getOrCreateLocalDir
((
err
,
data
)
=>
{
context
.
getOrCreateLocalDir
((
error
,
data
)
=>
{
console
.
info
(
'
getOrCreateLocalDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getOrCreateLocalDir fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getOrCreateLocalDir success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -96,8 +100,12 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -96,8 +100,12 @@ import featureAbility from '@ohos.ability.featureAbility';
import
bundle
from
'
@ohos.bundle.bundleManager
'
;
import
bundle
from
'
@ohos.bundle.bundleManager
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
bundle
.
getBundleInfo
(
'
com.context.test
'
,
1
,
(
err
,
datainfo
)
=>
{
bundle
.
getBundleInfo
(
'
com.context.test
'
,
1
,
(
err
,
datainfo
)
=>
{
context
.
verifyPermission
(
'
com.example.permission
'
,
{
uid
:
datainfo
.
appInfo
.
uid
},
(
err
,
data
)
=>
{
context
.
verifyPermission
(
'
com.example.permission
'
,
{
uid
:
datainfo
.
appInfo
.
uid
},
(
error
,
data
)
=>
{
console
.
info
(
'
verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
verifyPermission fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
verifyPermission success, data: ${JSON.stringify(data)}
'
);
}
});
});
});
});
```
```
...
@@ -125,8 +133,12 @@ verifyPermission(permission: string, callback: AsyncCallback\<number>): void
...
@@ -125,8 +133,12 @@ verifyPermission(permission: string, callback: AsyncCallback\<number>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
verifyPermission
(
'
com.example.permission
'
,
(
err
,
data
)
=>
{
context
.
verifyPermission
(
'
com.example.permission
'
,
(
error
,
data
)
=>
{
console
.
info
(
'
verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
verifyPermission fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
verifyPermission success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -192,8 +204,12 @@ context.requestPermissionsFromUser(
...
@@ -192,8 +204,12 @@ context.requestPermissionsFromUser(
'
com.example.permission4
'
,
'
com.example.permission4
'
,
'
com.example.permission5
'
],
'
com.example.permission5
'
],
1
,
1
,
(
err
,
data
)
=>
{
(
error
,
data
)
=>
{
console
.
info
(
'
requestPermissionsFromUser err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
requestPermissionsFromUser fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
requestPermissionsFromUser success, data: ${JSON.stringify(data)}
'
);
}
}
}
);
);
```
```
...
@@ -258,8 +274,12 @@ getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>): void
...
@@ -258,8 +274,12 @@ getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getApplicationInfo
((
err
,
data
)
=>
{
context
.
getApplicationInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getApplicationInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getApplicationInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getApplicationInfo success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -310,8 +330,12 @@ getBundleName(callback: AsyncCallback\<string>): void
...
@@ -310,8 +330,12 @@ getBundleName(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getBundleName
((
err
,
data
)
=>
{
context
.
getBundleName
((
error
,
data
)
=>
{
console
.
info
(
'
getBundleName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getBundleName fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getBundleName success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -360,8 +384,12 @@ getDisplayOrientation(callback: AsyncCallback\<bundle.DisplayOrientation>): void
...
@@ -360,8 +384,12 @@ getDisplayOrientation(callback: AsyncCallback\<bundle.DisplayOrientation>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getDisplayOrientation
((
err
,
data
)
=>
{
context
.
getDisplayOrientation
((
error
,
data
)
=>
{
console
.
info
(
'
getDisplayOrientation err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getDisplayOrientation fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getDisplayOrientation success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -408,8 +436,12 @@ getExternalCacheDir(callback: AsyncCallback\<string>): void
...
@@ -408,8 +436,12 @@ getExternalCacheDir(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getExternalCacheDir
((
err
,
data
)
=>
{
context
.
getExternalCacheDir
((
error
,
data
)
=>
{
console
.
info
(
'
getExternalCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getExternalCacheDir fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getExternalCacheDir success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -459,8 +491,8 @@ import featureAbility from '@ohos.ability.featureAbility';
...
@@ -459,8 +491,8 @@ import featureAbility from '@ohos.ability.featureAbility';
import
bundle
from
'
@ohos.bundle
'
;
import
bundle
from
'
@ohos.bundle
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
let
orientation
=
bundle
.
DisplayOrientation
.
UNSPECIFIED
;
let
orientation
=
bundle
.
DisplayOrientation
.
UNSPECIFIED
;
context
.
setDisplayOrientation
(
orientation
,
(
err
)
=>
{
context
.
setDisplayOrientation
(
orientation
,
(
err
or
)
=>
{
console
.
info
(
'
setDisplayOrientation err: ${JSON.stringify(er
r)}
'
);
console
.
error
(
'
setDisplayOrientation fail, error: ${JSON.stringify(erro
r)}
'
);
});
});
```
```
...
@@ -512,8 +544,8 @@ setShowOnLockScreen(show: boolean, callback: AsyncCallback\<void>): void
...
@@ -512,8 +544,8 @@ setShowOnLockScreen(show: boolean, callback: AsyncCallback\<void>): void
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
let
show
=
true
;
let
show
=
true
;
context
.
setShowOnLockScreen
(
show
,
(
err
)
=>
{
context
.
setShowOnLockScreen
(
show
,
(
err
or
)
=>
{
console
.
info
(
'
setShowOnLockScreen err: ${JSON.stringify(er
r)}
'
);
console
.
error
(
'
setShowOnLockScreen fail, error: ${JSON.stringify(erro
r)}
'
);
});
});
```
```
...
@@ -569,8 +601,8 @@ setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\<void>): void
...
@@ -569,8 +601,8 @@ setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\<void>): void
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
let
wakeUp
=
true
;
let
wakeUp
=
true
;
context
.
setWakeUpScreen
(
wakeUp
,
(
err
)
=>
{
context
.
setWakeUpScreen
(
wakeUp
,
(
err
or
)
=>
{
console
.
info
(
'
setWakeUpScreen err: ${JSON.stringify(er
r)}
'
);
console
.
error
(
'
setWakeUpScreen fail, error: ${JSON.stringify(erro
r)}
'
);
});
});
```
```
...
@@ -627,8 +659,12 @@ getProcessInfo(callback: AsyncCallback\<ProcessInfo>): void
...
@@ -627,8 +659,12 @@ getProcessInfo(callback: AsyncCallback\<ProcessInfo>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getProcessInfo
((
err
,
data
)
=>
{
context
.
getProcessInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getProcessInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getProcessInfo success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -681,8 +717,12 @@ getElementName(callback: AsyncCallback\<ElementName>): void
...
@@ -681,8 +717,12 @@ getElementName(callback: AsyncCallback\<ElementName>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getElementName
((
err
,
data
)
=>
{
context
.
getElementName
((
error
,
data
)
=>
{
console
.
info
(
'
getElementName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getElementName fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getElementName success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -733,8 +773,12 @@ getProcessName(callback: AsyncCallback\<string>): void
...
@@ -733,8 +773,12 @@ getProcessName(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getProcessName
((
err
,
data
)
=>
{
context
.
getProcessName
((
error
,
data
)
=>
{
console
.
info
(
'
getProcessName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getProcessName fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getProcessName success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -785,8 +829,12 @@ getCallingBundle(callback: AsyncCallback\<string>): void
...
@@ -785,8 +829,12 @@ getCallingBundle(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getCallingBundle
((
err
,
data
)
=>
{
context
.
getCallingBundle
((
error
,
data
)
=>
{
console
.
info
(
'
getCallingBundle err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getCallingBundle fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getCallingBundle success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -835,8 +883,12 @@ getCacheDir(callback: AsyncCallback\<string>): void
...
@@ -835,8 +883,12 @@ getCacheDir(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getCacheDir
((
err
,
data
)
=>
{
context
.
getCacheDir
((
error
,
data
)
=>
{
console
.
info
(
'
getCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getCacheDir fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getCacheDir success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -883,8 +935,12 @@ getFilesDir(callback: AsyncCallback\<string>): void
...
@@ -883,8 +935,12 @@ getFilesDir(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
((
err
,
data
)
=>
{
context
.
getFilesDir
((
error
,
data
)
=>
{
console
.
info
(
'
getFilesDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getFilesDir fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getFilesDir success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -933,8 +989,12 @@ getOrCreateDistributedDir(callback: AsyncCallback\<string>): void
...
@@ -933,8 +989,12 @@ getOrCreateDistributedDir(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getOrCreateDistributedDir
((
err
,
data
)
=>
{
context
.
getOrCreateDistributedDir
((
error
,
data
)
=>
{
console
.
info
(
'
getOrCreateDistributedDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getOrCreateDistributedDir fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getOrCreateDistributedDir success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -983,8 +1043,12 @@ getAppType(callback: AsyncCallback\<string>): void
...
@@ -983,8 +1043,12 @@ getAppType(callback: AsyncCallback\<string>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getAppType
((
err
,
data
)
=>
{
context
.
getAppType
((
error
,
data
)
=>
{
console
.
info
(
'
getAppType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getAppType fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getAppType success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -1031,8 +1095,12 @@ getHapModuleInfo(callback: AsyncCallback\<HapModuleInfo>): void
...
@@ -1031,8 +1095,12 @@ getHapModuleInfo(callback: AsyncCallback\<HapModuleInfo>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getHapModuleInfo
((
err
,
data
)
=>
{
context
.
getHapModuleInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getHapModuleInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getHapModuleInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getHapModuleInfo success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -1079,8 +1147,12 @@ getAppVersionInfo(callback: AsyncCallback\<AppVersionInfo>): void
...
@@ -1079,8 +1147,12 @@ getAppVersionInfo(callback: AsyncCallback\<AppVersionInfo>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getAppVersionInfo
((
err
,
data
)
=>
{
context
.
getAppVersionInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getAppVersionInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getAppVersionInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getAppVersionInfo success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -1127,8 +1199,12 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void
...
@@ -1127,8 +1199,12 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getAbilityInfo
((
err
,
data
)
=>
{
context
.
getAbilityInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getAbilityInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getAbilityInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getAbilityInfo success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -1196,8 +1272,12 @@ isUpdatingConfigurations(callback: AsyncCallback\<boolean>): void;
...
@@ -1196,8 +1272,12 @@ isUpdatingConfigurations(callback: AsyncCallback\<boolean>): void;
```
ts
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
isUpdatingConfigurations
((
err
,
data
)
=>
{
context
.
isUpdatingConfigurations
((
error
,
data
)
=>
{
console
.
info
(
'
isUpdatingConfigurations err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
isUpdatingConfigurations fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
isUpdatingConfigurations success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md
浏览文件 @
514c979d
...
@@ -18,9 +18,11 @@
...
@@ -18,9 +18,11 @@
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
getProcessInfo
((
err
,
data
)
=>
{
context
.
getProcessInfo
((
error
,
data
)
=>
{
if
(
err
.
code
!==
0
)
{
if
(
error
&&
error
.
code
!==
0
)
{
console
.
info
(
'
getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}
'
);
console
.
error
(
'
getProcessInfo fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getProcessInfo success, data: ${JSON.stringify(data)}
'
);
let
pid
=
data
.
pid
;
let
pid
=
data
.
pid
;
let
processName
=
data
.
processName
;
let
processName
=
data
.
processName
;
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
浏览文件 @
514c979d
...
@@ -38,7 +38,7 @@ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void
...
@@ -38,7 +38,7 @@ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void
let
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
console
.
info
(
'
onAbilityCreateCallback
, data: ${JSON.stringify(data)}
'
);
}
}
let
monitor
=
{
let
monitor
=
{
...
@@ -47,8 +47,8 @@ let monitor = {
...
@@ -47,8 +47,8 @@ let monitor = {
};
};
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
addAbilityMonitor
(
monitor
,
(
err
:
any
)
=>
{
abilityDelegator
.
addAbilityMonitor
(
monitor
,
(
err
or
:
any
)
=>
{
console
.
info
(
'
addAbilityMonitor callback
'
);
console
.
error
(
'
addAbilityMonitor fail, error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -122,8 +122,8 @@ let monitor = {
...
@@ -122,8 +122,8 @@ let monitor = {
};
};
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
removeAbilityMonitor
(
monitor
,
(
err
:
any
)
=>
{
abilityDelegator
.
removeAbilityMonitor
(
monitor
,
(
err
or
:
any
)
=>
{
console
.
info
(
'
removeAbilityMonitor callback
'
);
console
.
error
(
'
removeAbilityMonitor fail, error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -197,8 +197,12 @@ let monitor = {
...
@@ -197,8 +197,12 @@ let monitor = {
};
};
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
waitAbilityMonitor
(
monitor
,
(
err
:
any
,
data
:
any
)
=>
{
abilityDelegator
.
waitAbilityMonitor
(
monitor
,
(
error
:
any
,
data
:
any
)
=>
{
console
.
info
(
'
waitAbilityMonitor callback
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
waitAbilityMonitor fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
waitAbilityMonitor success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
@@ -234,8 +238,12 @@ let monitor = {
...
@@ -234,8 +238,12 @@ let monitor = {
};
};
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
waitAbilityMonitor
(
monitor
,
timeout
,
(
err
:
any
,
data
:
any
)
=>
{
abilityDelegator
.
waitAbilityMonitor
(
monitor
,
timeout
,
(
error
:
any
,
data
:
any
)
=>
{
console
.
info
(
'
waitAbilityMonitor callback
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
waitAbilityMonitor fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
waitAbilityMonitor success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md
浏览文件 @
514c979d
...
@@ -34,7 +34,7 @@ Ability监听器
...
@@ -34,7 +34,7 @@ Ability监听器
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
function
onAbilityCreateCallback
(
data
)
{
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
console
.
info
(
'
onAbilityCreateCallback
, data: ${JSON.stringify(data)}
'
);
}
}
let
monitor
=
{
let
monitor
=
{
...
@@ -44,8 +44,10 @@ let monitor = {
...
@@ -44,8 +44,10 @@ let monitor = {
};
};
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
addAbilityMonitor
(
monitor
,
(
err
:
any
)
=>
{
abilityDelegator
.
addAbilityMonitor
(
monitor
,
(
error
:
any
)
=>
{
console
.
info
(
'
addAbilityMonitor callback
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
addAbilityMonitor fail, error: ${JSON.stringify(error)}
'
);
}
});
});
```
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md
浏览文件 @
514c979d
...
@@ -30,16 +30,20 @@ AbilityRunningInfo模块提供对Ability运行的相关信息和状态的定义
...
@@ -30,16 +30,20 @@ AbilityRunningInfo模块提供对Ability运行的相关信息和状态的定义
```
ts
```
ts
import
abilitymanager
from
'
@ohos.app.ability.abilityManager
'
;
import
abilitymanager
from
'
@ohos.app.ability.abilityManager
'
;
abilitymanager
.
getAbilityRunningInfos
((
err
,
data
)
=>
{
abilitymanager
.
getAbilityRunningInfos
((
error
,
data
)
=>
{
console
.
log
(
'
getAbilityRunningInfos err: ${err}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
error
(
'
getAbilityRunningInfos fail, error: ${JSON.stringify(error)}
'
);
let
abilityinfo
=
data
[
i
];
}
else
{
console
.
log
(
'
abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}
'
);
console
.
log
(
'
getAbilityRunningInfos success, data: ${JSON.stringify(data)}
'
);
console
.
log
(
'
abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}
'
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
'
abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}
'
);
let
abilityinfo
=
data
[
i
];
console
.
log
(
'
abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}
'
);
console
.
log
(
'
abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}
'
);
console
.
log
(
'
abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}
'
);
console
.
log
(
'
abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}
'
);
console
.
log
(
'
abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}
'
);
console
.
log
(
'
abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}
'
);
console
.
log
(
'
abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}
'
);
console
.
log
(
'
abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}
'
);
console
.
log
(
'
abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}
'
);
}
}
}
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md
浏览文件 @
514c979d
...
@@ -20,6 +20,10 @@ let monitor = {
...
@@ -20,6 +20,10 @@ let monitor = {
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
waitAbilityStageMonitor
(
monitor
,
(
error
,
data
)
=>
{
abilityDelegator
.
waitAbilityStageMonitor
(
monitor
,
(
error
,
data
)
=>
{
console
.
info
(
'
stageMonitor waitAbilityStageMonitor, abilityStage = ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
waitAbilityStageMonitor success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md
浏览文件 @
514c979d
...
@@ -703,10 +703,10 @@ try {
...
@@ -703,10 +703,10 @@ try {
console
.
log
(
'
get attribute value by name success
'
);
console
.
log
(
'
get attribute value by name success
'
);
attributeValue
=
data
;
attributeValue
=
data
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to get attribute value, because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to get attribute value, because ${JSON.stringify(err)}
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to get attribute value, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to get attribute value, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## AccessibilityElement.attributeValue
## AccessibilityElement.attributeValue
...
@@ -749,7 +749,7 @@ try {
...
@@ -749,7 +749,7 @@ try {
console
.
info
(
'
get attribute value success
'
);
console
.
info
(
'
get attribute value success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to get attribute value, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to get attribute value, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## actionNames
## actionNames
...
@@ -775,7 +775,7 @@ rootElement.actionNames().then((data) => {
...
@@ -775,7 +775,7 @@ rootElement.actionNames().then((data) => {
console
.
log
(
'
get action names success
'
);
console
.
log
(
'
get action names success
'
);
actionNames
=
data
;
actionNames
=
data
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to get action names because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to get action names because ${JSON.stringify(err)}
'
);
});
});
```
```
## actionNames
## actionNames
...
@@ -843,10 +843,10 @@ try {
...
@@ -843,10 +843,10 @@ try {
rootElement
.
performAction
(
'
action
'
).
then
((
data
)
=>
{
rootElement
.
performAction
(
'
action
'
).
then
((
data
)
=>
{
console
.
info
(
'
perform action success
'
);
console
.
info
(
'
perform action success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to perform action, because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to perform action, because ${JSON.stringify(err)}
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## performAction
## performAction
...
@@ -885,7 +885,7 @@ try {
...
@@ -885,7 +885,7 @@ try {
console
.
info
(
'
perform action success
'
);
console
.
info
(
'
perform action success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## performAction
## performAction
...
@@ -929,7 +929,7 @@ try {
...
@@ -929,7 +929,7 @@ try {
console
.
info
(
'
perform action success
'
);
console
.
info
(
'
perform action success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to perform action, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('content')
## findElement('content')
...
@@ -965,10 +965,10 @@ try {
...
@@ -965,10 +965,10 @@ try {
elements
=
data
;
elements
=
data
;
console
.
log
(
'
find element success
'
);
console
.
log
(
'
find element success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('content')
## findElement('content')
...
@@ -1004,7 +1004,7 @@ try {
...
@@ -1004,7 +1004,7 @@ try {
console
.
info
(
'
find element success
'
);
console
.
info
(
'
find element success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('focusType')
## findElement('focusType')
...
@@ -1040,10 +1040,10 @@ try {
...
@@ -1040,10 +1040,10 @@ try {
element
=
data
;
element
=
data
;
console
.
log
(
'
find element success
'
);
console
.
log
(
'
find element success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('focusType')
## findElement('focusType')
...
@@ -1079,7 +1079,7 @@ try {
...
@@ -1079,7 +1079,7 @@ try {
console
.
info
(
'
find element success
'
);
console
.
info
(
'
find element success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('focusDirection')
## findElement('focusDirection')
...
@@ -1115,10 +1115,10 @@ try {
...
@@ -1115,10 +1115,10 @@ try {
element
=
data
;
element
=
data
;
console
.
log
(
'
find element success
'
);
console
.
log
(
'
find element success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(err)}
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
## findElement('focusDirection')
## findElement('focusDirection')
...
@@ -1154,6 +1154,6 @@ try {
...
@@ -1154,6 +1154,6 @@ try {
console
.
info
(
'
find element success
'
);
console
.
info
(
'
find element success
'
);
});
});
}
catch
(
exception
)
{
}
catch
(
exception
)
{
console
.
log
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
console
.
error
(
'
failed to find element, because ${JSON.stringify(exception)}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md
浏览文件 @
514c979d
...
@@ -298,7 +298,7 @@ let applicationContext = this.context.getApplicationContext();
...
@@ -298,7 +298,7 @@ let applicationContext = this.context.getApplicationContext();
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
'
The process running information is: ${JSON.stringify(data)}
'
);
console
.
log
(
'
The process running information is: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
error: ${JSON.stringify(error)}
'
);
console
.
error
(
'
error: ${JSON.stringify(error)}
'
);
});
});
```
```
...
@@ -372,7 +372,9 @@ killAllProcesses(callback: AsyncCallback\<void\>);
...
@@ -372,7 +372,9 @@ killAllProcesses(callback: AsyncCallback\<void\>);
```
ts
```
ts
let
applicationContext
=
this
.
context
.
getApplicationContext
();
let
applicationContext
=
this
.
context
.
getApplicationContext
();
applicationContext
.
killAllProcesses
(
err
=>
{
applicationContext
.
killAllProcesses
(
error
=>
{
console
.
error
(
'
killAllProcesses result: ${JSON.stringify(err)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
killAllProcesses fail, error: ${JSON.stringify(error)}
'
);
}
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
浏览文件 @
514c979d
...
@@ -62,7 +62,7 @@ let bundleContext;
...
@@ -62,7 +62,7 @@ let bundleContext;
try
{
try
{
bundleContext
=
this
.
context
.
createBundleContext
(
'
com.example.test
'
);
bundleContext
=
this
.
context
.
createBundleContext
(
'
com.example.test
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
```
```
...
@@ -101,7 +101,7 @@ let moduleContext;
...
@@ -101,7 +101,7 @@ let moduleContext;
try
{
try
{
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry
'
);
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
```
```
...
@@ -141,7 +141,7 @@ let moduleContext;
...
@@ -141,7 +141,7 @@ let moduleContext;
try
{
try
{
moduleContext
=
this
.
context
.
createModuleContext
(
'
com.example.test
'
,
'
entry
'
);
moduleContext
=
this
.
context
.
createModuleContext
(
'
com.example.test
'
,
'
entry
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
```
```
...
@@ -166,7 +166,7 @@ let applicationContext;
...
@@ -166,7 +166,7 @@ let applicationContext;
try
{
try
{
applicationContext
=
this
.
context
.
getApplicationContext
();
applicationContext
=
this
.
context
.
getApplicationContext
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md
浏览文件 @
514c979d
...
@@ -38,7 +38,7 @@ Mission迁移完成后调用,返回迁移结果。
...
@@ -38,7 +38,7 @@ Mission迁移完成后调用,返回迁移结果。
distributedMissionManager
.
continueMission
(
continueDeviceInfo
,
continueCallback
,
(
error
)
=>
{
distributedMissionManager
.
continueMission
(
continueDeviceInfo
,
continueCallback
,
(
error
)
=>
{
if
(
error
&&
error
.
code
)
{
if
(
error
&&
error
.
code
)
{
console
.
log
(
'
continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
console
.
log
(
'
continueMission finished
'
);
console
.
log
(
'
continueMission finished
'
);
});
});
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
浏览文件 @
514c979d
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
distributedMissionManager
.
continueMission
(
continueDeviceInfo
,
continueCallback
,
(
error
)
=>
{
distributedMissionManager
.
continueMission
(
continueDeviceInfo
,
continueCallback
,
(
error
)
=>
{
if
(
error
&&
error
.
code
)
{
if
(
error
&&
error
.
code
)
{
console
.
log
(
'
continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
console
.
log
(
'
continueMission finished
'
);
console
.
log
(
'
continueMission finished
'
);
});
});
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md
浏览文件 @
514c979d
...
@@ -23,13 +23,13 @@ import errorManager from '@ohos.app.ability.errorManager';
...
@@ -23,13 +23,13 @@ import errorManager from '@ohos.app.ability.errorManager';
let
observer
=
{
let
observer
=
{
onUnhandledException
(
errorMsg
)
{
onUnhandledException
(
errorMsg
)
{
console
.
log
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
);
console
.
error
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
);
}
}
};
};
try
{
try
{
errorManager
.
on
(
'
error
'
,
observer
);
errorManager
.
on
(
'
error
'
,
observer
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
}
}
```
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md
浏览文件 @
514c979d
...
@@ -33,7 +33,7 @@ let upperLimit = 1;
...
@@ -33,7 +33,7 @@ let upperLimit = 1;
function
getExtensionInfos
()
{
function
getExtensionInfos
()
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
error
,
data
)
=>
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
error
,
data
)
=>
{
if
(
error
&&
error
.
code
)
{
if
(
error
&&
error
.
code
)
{
console
.
log
(
'
getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
浏览文件 @
514c979d
...
@@ -67,7 +67,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
...
@@ -67,7 +67,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
};
};
this
.
context
.
startAbility
(
want
,
(
error
,
data
)
=>
{
this
.
context
.
startAbility
(
want
,
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'
FormExtensionContext startAbility, error:${JSON.stringify(error)}
'
);
console
.
error
(
'
FormExtensionContext startAbility, error:${JSON.stringify(error)}
'
);
}
else
{
}
else
{
console
.
log
(
'
FormExtensionContext startAbility success
'
);
console
.
log
(
'
FormExtensionContext startAbility success
'
);
}
}
...
@@ -118,7 +118,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
...
@@ -118,7 +118,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
this
.
context
.
startAbility
(
want
).
then
(()
=>
{
this
.
context
.
startAbility
(
want
).
then
(()
=>
{
console
.
info
(
'
StartAbility Success
'
);
console
.
info
(
'
StartAbility Success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
'
StartAbility failed
'
);
console
.
error
(
'
StartAbility failed
'
);
});
});
}
}
};
};
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
浏览文件 @
514c979d
...
@@ -25,7 +25,7 @@ try {
...
@@ -25,7 +25,7 @@ try {
missionManager
.
getMissionInfo
(
''
,
1
,
(
error
,
data
)
=>
{
missionManager
.
getMissionInfo
(
''
,
1
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
...
@@ -39,6 +39,6 @@ try {
...
@@ -39,6 +39,6 @@ try {
console
.
log
(
'
getMissionInfo continuable is: ${JSON.stringify(data.continuable)}
'
);
console
.
log
(
'
getMissionInfo continuable is: ${JSON.stringify(data.continuable)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
浏览文件 @
514c979d
...
@@ -42,6 +42,6 @@ let listener = {
...
@@ -42,6 +42,6 @@ let listener = {
try
{
try
{
let
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
let
listenerId
=
missionManager
.
on
(
'
mission
'
,
listener
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionParameter.md
浏览文件 @
514c979d
...
@@ -21,8 +21,12 @@ let missionParameter = {
...
@@ -21,8 +21,12 @@ let missionParameter = {
};
};
try
{
try
{
distributedMissionManager
.
startSyncRemoteMissions
(
missionParameter
,
distributedMissionManager
.
startSyncRemoteMissions
(
missionParameter
,
(
err
,
data
)
=>
{
(
error
,
data
)
=>
{
console
.
log
(
'
startSyncRemoteMissions, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
startSyncRemoteMissions fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
startSyncRemoteMissions success, data: ${JSON.stringify(data)}
'
);
}
}
}
);
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md
浏览文件 @
514c979d
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
try
{
try
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
log
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
console
.
log
(
'
size = ${missions.length}
'
);
console
.
log
(
'
size = ${missions.length}
'
);
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
missionManager
.
getMissionSnapShot
(
''
,
id
,
(
err
,
snapshot
)
=>
{
missionManager
.
getMissionSnapShot
(
''
,
id
,
(
err
,
snapshot
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
log
(
'
getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}
'
);
console
.
error
(
'
getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}
'
);
return
;
return
;
}
}
...
@@ -45,6 +45,6 @@
...
@@ -45,6 +45,6 @@
});
});
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
console
.
log
(
'
error: ${paramError.code}, ${paramError.message}
'
);
console
.
error
(
'
error: ${paramError.code}, ${paramError.message}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md
浏览文件 @
514c979d
...
@@ -14,7 +14,11 @@ ProcessInformation模块提供对进程运行信息进行查询的能力。
...
@@ -14,7 +14,11 @@ ProcessInformation模块提供对进程运行信息进行查询的能力。
import
appManager
from
'
@ohos.app.ability.appManager
'
;
import
appManager
from
'
@ohos.app.ability.appManager
'
;
appManager
.
getRunningProcessInformation
((
error
,
data
)
=>
{
appManager
.
getRunningProcessInformation
((
error
,
data
)
=>
{
console
.
log
(
'
error: ${error.code}, data: ${JSON.stringify(data)}
'
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
error
(
'
getRunningProcessInformation fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
getRunningProcessInformation success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md
浏览文件 @
514c979d
...
@@ -28,6 +28,6 @@ import appManager from '@ohos.app.ability.appManager';
...
@@ -28,6 +28,6 @@ import appManager from '@ohos.app.ability.appManager';
appManager
.
getProcessRunningInfos
().
then
((
data
)
=>
{
appManager
.
getProcessRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
'
success: ${JSON.stringify(data)}
'
);
console
.
log
(
'
success: ${JSON.stringify(data)}
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
failed: ${JSON.stringify(error)}
'
);
console
.
error
(
'
failed: ${JSON.stringify(error)}
'
);
});
});
```
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
浏览文件 @
514c979d
...
@@ -77,7 +77,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
...
@@ -77,7 +77,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -85,7 +85,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
...
@@ -85,7 +85,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -155,11 +155,11 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
...
@@ -155,11 +155,11 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -221,7 +221,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
...
@@ -221,7 +221,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
this
.
context
.
startAbility
(
want
,
options
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
options
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -229,7 +229,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
...
@@ -229,7 +229,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -295,7 +295,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
...
@@ -295,7 +295,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
this
.
context
.
startAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
this
.
context
.
startAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -303,7 +303,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
...
@@ -303,7 +303,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -373,7 +373,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
...
@@ -373,7 +373,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
this
.
context
.
startAbilityWithAccount
(
want
,
accountId
,
options
,
(
error
)
=>
{
this
.
context
.
startAbilityWithAccount
(
want
,
accountId
,
options
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -381,7 +381,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
...
@@ -381,7 +381,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -461,11 +461,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
...
@@ -461,11 +461,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -516,7 +516,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
...
@@ -516,7 +516,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
this
.
context
.
startServiceExtensionAbility
(
want
,
(
error
)
=>
{
this
.
context
.
startServiceExtensionAbility
(
want
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -524,7 +524,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
...
@@ -524,7 +524,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -584,11 +584,11 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
...
@@ -584,11 +584,11 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -645,7 +645,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
...
@@ -645,7 +645,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
this
.
context
.
startServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
this
.
context
.
startServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -653,7 +653,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
...
@@ -653,7 +653,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -718,11 +718,11 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
...
@@ -718,11 +718,11 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -770,7 +770,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
...
@@ -770,7 +770,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
this
.
context
.
stopServiceExtensionAbility
(
want
,
(
error
)
=>
{
this
.
context
.
stopServiceExtensionAbility
(
want
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -778,7 +778,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
...
@@ -778,7 +778,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -835,11 +835,11 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
...
@@ -835,11 +835,11 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -892,7 +892,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
...
@@ -892,7 +892,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
this
.
context
.
stopServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
this
.
context
.
stopServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -900,7 +900,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
...
@@ -900,7 +900,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -962,11 +962,11 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
...
@@ -962,11 +962,11 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1003,7 +1003,7 @@ terminateSelf(callback: AsyncCallback<void>): void;
...
@@ -1003,7 +1003,7 @@ terminateSelf(callback: AsyncCallback<void>): void;
this
.
context
.
terminateSelf
((
error
)
=>
{
this
.
context
.
terminateSelf
((
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -1046,7 +1046,7 @@ terminateSelf(): Promise<void>;
...
@@ -1046,7 +1046,7 @@ terminateSelf(): Promise<void>;
console
.
log
(
'
terminateSelf succeed
'
);
console
.
log
(
'
terminateSelf succeed
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
```
```
...
@@ -1095,7 +1095,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
...
@@ -1095,7 +1095,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
let
options
=
{
let
options
=
{
onConnect
(
elementName
,
remote
)
{
console
.
log
(
'
----------- onConnect -----------
'
)
},
onConnect
(
elementName
,
remote
)
{
console
.
log
(
'
----------- onConnect -----------
'
)
},
onDisconnect
(
elementName
)
{
console
.
log
(
'
----------- onDisconnect -----------
'
)
},
onDisconnect
(
elementName
)
{
console
.
log
(
'
----------- onDisconnect -----------
'
)
},
onFailed
(
code
)
{
console
.
log
(
'
----------- onFailed -----------
'
)
}
onFailed
(
code
)
{
console
.
error
(
'
----------- onFailed -----------
'
)
}
};
};
let
connection
=
null
;
let
connection
=
null
;
...
@@ -1103,7 +1103,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
...
@@ -1103,7 +1103,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
connection
=
this
.
context
.
connectServiceExtensionAbility
(
want
,
options
);
connection
=
this
.
context
.
connectServiceExtensionAbility
(
want
,
options
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1164,7 +1164,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
...
@@ -1164,7 +1164,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
connection
=
this
.
context
.
connectServiceExtensionAbilityWithAccount
(
want
,
accountId
,
options
);
connection
=
this
.
context
.
connectServiceExtensionAbilityWithAccount
(
want
,
accountId
,
options
);
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1206,7 +1206,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<
...
@@ -1206,7 +1206,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<
this
.
context
.
disconnectServiceExtensionAbility
(
connection
,
(
error
)
=>
{
this
.
context
.
disconnectServiceExtensionAbility
(
connection
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -1214,7 +1214,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<
...
@@ -1214,7 +1214,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1265,11 +1265,11 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>;
...
@@ -1265,11 +1265,11 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1337,11 +1337,11 @@ startAbilityByCall(want: Want): Promise<Caller>;
...
@@ -1337,11 +1337,11 @@ startAbilityByCall(want: Want): Promise<Caller>;
console
.
log
(
'
startAbilityByCall succeed
'
);
console
.
log
(
'
startAbilityByCall succeed
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
...
@@ -1369,10 +1369,10 @@ startAbilityByCall(want: Want): Promise<Caller>;
...
@@ -1369,10 +1369,10 @@ startAbilityByCall(want: Want): Promise<Caller>;
console
.
log
(
'
startAbilityByCall succeed
'
);
console
.
log
(
'
startAbilityByCall succeed
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
console
.
log
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
console
.
error
(
'
error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}
'
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md
浏览文件 @
514c979d
...
@@ -24,8 +24,11 @@ let abilityDelegator;
...
@@ -24,8 +24,11 @@ let abilityDelegator;
let
cmd
=
'
cmd
'
;
let
cmd
=
'
cmd
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
data
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmd
,
(
error
:
any
,
data
:
any
)
=>
{
console
.
info
(
'
executeShellCommand callback, result:
'
,
err
);
if
(
error
&&
error
.
code
!==
0
)
{
console
.
info
(
'
executeShellCommand callback, data:
'
,
data
);
console
.
error
(
'
executeShellCommand fail, error: ${JSON.stringify(error)}
'
);
}
else
{
console
.
log
(
'
executeShellCommand success, data: ${JSON.stringify(data)}
'
);
}
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md
浏览文件 @
514c979d
...
@@ -58,7 +58,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
...
@@ -58,7 +58,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
this
.
context
.
startAbility
(
want
,
options
,
(
error
)
=>
{
this
.
context
.
startAbility
(
want
,
options
,
(
error
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
return
;
return
;
}
}
// 执行正常业务
// 执行正常业务
...
@@ -110,7 +110,7 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>
...
@@ -110,7 +110,7 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
// 处理业务逻辑错误
// 处理业务逻辑错误
console
.
log
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
console
.
error
(
'
startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}
'
);
});
});
}
catch
(
paramError
)
{
}
catch
(
paramError
)
{
// 处理入参错误异常
// 处理入参错误异常
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录