Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b94e58ca
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b94e58ca
编写于
8月 30, 2023
作者:
G
geng-wenguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
arkts 告警清理
Signed-off-by:
N
geng-wenguang
<
gengwenguang@huawei.com
>
上级
ef89df4e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
23 deletion
+49
-23
zh-cn/application-dev/reference/apis/js-apis-appControl.md
zh-cn/application-dev/reference/apis/js-apis-appControl.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md
...n/application-dev/reference/apis/js-apis-bundleMonitor.md
+8
-2
zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md
...plication-dev/reference/apis/js-apis-defaultAppManager.md
+38
-18
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-appControl.md
浏览文件 @
b94e58ca
...
@@ -60,11 +60,11 @@ try {
...
@@ -60,11 +60,11 @@ try {
.
then
(()
=>
{
.
then
(()
=>
{
console
.
info
(
'
setDisposedStatus success
'
);
console
.
info
(
'
setDisposedStatus success
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
let
message
=
(
err
as
BusinessError
).
message
;
let
message
=
(
err
or
as
BusinessError
).
message
;
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
let
message
=
(
err
as
BusinessError
).
message
;
let
message
=
(
err
or
as
BusinessError
).
message
;
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
}
}
```
```
...
@@ -116,7 +116,7 @@ try {
...
@@ -116,7 +116,7 @@ try {
console
.
info
(
'
setDisposedStatus success
'
);
console
.
info
(
'
setDisposedStatus success
'
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
let
message
=
(
err
as
BusinessError
).
message
;
let
message
=
(
err
or
as
BusinessError
).
message
;
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
console
.
error
(
'
setDisposedStatus failed
'
+
message
);
}
}
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md
浏览文件 @
b94e58ca
...
@@ -68,13 +68,16 @@ on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
...
@@ -68,13 +68,16 @@ on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
```
ts
```
ts
import
bundleMonitor
from
'
@ohos.bundle.bundleMonitor
'
;
import
bundleMonitor
from
'
@ohos.bundle.bundleMonitor
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
bundleMonitor
.
on
(
'
add
'
,
(
bundleChangeInfo
)
=>
{
bundleMonitor
.
on
(
'
add
'
,
(
bundleChangeInfo
)
=>
{
console
.
info
(
`bundleName :
${
bundleChangeInfo
.
bundleName
}
userId :
${
bundleChangeInfo
.
userId
}
`
);
console
.
info
(
`bundleName :
${
bundleChangeInfo
.
bundleName
}
userId :
${
bundleChangeInfo
.
userId
}
`
);
})
})
}
catch
(
errData
)
{
}
catch
(
errData
)
{
console
.
log
(
`errData is errCode:
${
errData
.
errCode
}
message:
${
errData
.
message
}
`
);
let
message
=
(
errData
as
BusinessError
).
message
;
let
errCode
=
(
errData
as
BusinessError
).
code
;
console
.
log
(
`errData is errCode:
${
errCode
}
message:
${
message
}
`
);
}
}
```
```
...
@@ -101,10 +104,13 @@ off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
...
@@ -101,10 +104,13 @@ off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
```
ts
```
ts
import
bundleMonitor
from
'
@ohos.bundle.bundleMonitor
'
;
import
bundleMonitor
from
'
@ohos.bundle.bundleMonitor
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
bundleMonitor
.
off
(
'
add
'
);
bundleMonitor
.
off
(
'
add
'
);
}
catch
(
errData
)
{
}
catch
(
errData
)
{
console
.
log
(
`errData is errCode:
${
errData
.
errCode
}
message:
${
errData
.
message
}
`
);
let
message
=
(
errData
as
BusinessError
).
message
;
let
errCode
=
(
errData
as
BusinessError
).
code
;
console
.
log
(
`errData is errCode:
${
errCode
}
message:
${
message
}
`
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md
浏览文件 @
b94e58ca
...
@@ -390,25 +390,32 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
...
@@ -390,25 +390,32 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
```
ts
```
ts
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
let
info
:
defaultAppMgr
.
ElementName
=
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
abilityName
:
"
EntryAbility
"
}
}).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
});
let
userId
=
100
;
let
userId
=
100
;
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
,
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
});
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
info
,
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
void
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
...
@@ -453,12 +460,11 @@ import defaultAppMgr from '@ohos.bundle.defaultAppManager';
...
@@ -453,12 +460,11 @@ import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userId
=
100
;
let
userId
=
100
;
let
info
:
defaultAppMgr
.
ElementName
=
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
abilityName
:
"
EntryAbility
"
}
},
userId
,
(
errerr
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
,
userId
,
(
errerr
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -466,7 +472,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
...
@@ -466,7 +472,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
});
});
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
info
,
userId
,
(
errerr
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
userId
,
(
errerr
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -510,12 +520,11 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal
...
@@ -510,12 +520,11 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
info
:
defaultAppMgr
.
ElementName
=
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
abilityName
:
"
EntryAbility
"
}
},
(
err
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
,
(
err
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -523,7 +532,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
...
@@ -523,7 +532,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
});
});
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
info
,
(
err
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplication
(
"
image/png
"
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
(
err
:
BusinessError
,
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -566,25 +579,32 @@ setDefaultApplicationSync(type: string, elementName: ElementName, userId?: numbe
...
@@ -566,25 +579,32 @@ setDefaultApplicationSync(type: string, elementName: ElementName, userId?: numbe
```
ts
```
ts
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
import
defaultAppMgr
from
'
@ohos.bundle.defaultAppManager
'
;
let
info
:
defaultAppMgr
.
ElementName
=
{
defaultAppMgr
.
setDefaultApplicationSync
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
abilityName
:
"
EntryAbility
"
}
}).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplicationSync
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
});
let
userId
=
100
;
let
userId
=
100
;
defaultAppMgr
.
setDefaultApplicationSync
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
info
,
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplicationSync
(
defaultAppMgr
.
ApplicationType
.
BROWSER
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
});
defaultAppMgr
.
setDefaultApplicationSync
(
"
image/png
"
,
info
,
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
defaultAppMgr
.
setDefaultApplicationSync
(
"
image/png
"
,
{
bundleName
:
"
com.example.myapplication
"
,
moduleName
:
"
module01
"
,
abilityName
:
"
EntryAbility
"
},
userId
).
then
((
data
:
defaultAppMgr
.
AsyncCallback
<
BundleInfo
>
)
=>
{
console
.
info
(
'
Operation successful.
'
);
console
.
info
(
'
Operation successful.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录