Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
a15350a6
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看板
提交
a15350a6
编写于
8月 29, 2023
作者:
J
junyi233
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
批量修改场景---catch 明确错误码类型
Signed-off-by:
N
junyi233
<
zhengjun29@huawei.com
>
上级
fb8a824a
变更
2
展开全部
显示空白变更内容
内联
并排
Showing
2 changed file
with
290 addition
and
104 deletion
+290
-104
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
...n/application-dev/reference/apis/js-apis-bundleManager.md
+218
-88
zh-cn/application-dev/reference/apis/js-apis-overlay.md
zh-cn/application-dev/reference/apis/js-apis-overlay.md
+72
-16
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
浏览文件 @
a15350a6
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-overlay.md
浏览文件 @
a15350a6
...
...
@@ -45,6 +45,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\<void>;
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
...
...
@@ -52,11 +54,13 @@ try {
overlay
.
setOverlayEnabled
(
moduleName
,
isEnabled
)
.
then
(()
=>
{
console
.
info
(
'
setOverlayEnabled success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
});
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
```
...
...
@@ -88,6 +92,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
...
...
@@ -100,7 +106,9 @@ try {
console
.
info
(
'
setOverlayEnabled success
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
```
...
...
@@ -144,6 +152,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
...
...
@@ -152,11 +162,13 @@ try {
overlay
.
setOverlayEnabledByBundleName
(
bundleName
,
moduleName
,
isEnabled
)
.
then
((
data
)
=>
{
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
});
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
```
...
...
@@ -195,6 +207,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
...
...
@@ -208,7 +222,9 @@ try {
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
});
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
```
...
...
@@ -245,6 +261,8 @@ getOverlayModuleInfo(moduleName: string): Promise\<OverlayModuleInfo>;
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
(
async
()
=>
{
...
...
@@ -252,7 +270,9 @@ let moduleName = "feature";
let
overlayModuleInfo
=
await
overlay
.
getOverlayModuleInfo
(
moduleName
);
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
overlayModuleInfo
));
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
})();
```
...
...
@@ -285,6 +305,8 @@ getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\<OverlayModuleI
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
try
{
overlay
.
getOverlayModuleInfo
(
moduleName
,
(
err
,
data
)
=>
{
...
...
@@ -295,7 +317,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
@@ -331,6 +355,8 @@ getTargetOverlayModuleInfos(targetModuleName: string): Promise\<Array\<OverlayMo
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetModuleName
=
"
feature
"
;
(
async
()
=>
{
...
...
@@ -338,7 +364,9 @@ let targetModuleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
})();
```
...
...
@@ -370,6 +398,8 @@ getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\<A
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetModuleName
=
"
feature
"
;
try
{
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
,
(
err
,
data
)
=>
{
...
...
@@ -380,7 +410,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
@@ -423,6 +455,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promi
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
...
...
@@ -431,7 +465,9 @@ let moduleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getOverlayModuleInfoByBundleName
(
bundleName
,
moduleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
})();
```
...
...
@@ -470,6 +506,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callbac
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
...
...
@@ -482,7 +520,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
@@ -517,6 +557,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\<Ar
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
try
{
...
...
@@ -528,7 +570,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
@@ -571,6 +615,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName?: s
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
...
...
@@ -579,7 +625,9 @@ let moduleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfosByBundleName
(
targetBundleName
,
moduleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
})();
```
...
...
@@ -618,6 +666,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName: st
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
...
...
@@ -630,7 +680,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
@@ -665,6 +717,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, callback: Asyn
**示例:**
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
try
{
...
...
@@ -676,7 +730,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录