Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7c831620
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看板
未验证
提交
7c831620
编写于
2月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!15012 翻译完成:13891 Context文档描述修复
Merge pull request !15012 from wusongqing/TR13891
上级
63646182
39707009
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
16 deletion
+5
-16
en/application-dev/reference/apis/js-apis-inner-application-context.md
...n-dev/reference/apis/js-apis-inner-application-context.md
+5
-16
未找到文件。
en/application-dev/reference/apis/js-apis-inner-application-context.md
浏览文件 @
7c831620
...
...
@@ -22,8 +22,8 @@ The **Context** module provides context for abilities or applications. It allows
| preferencesDir | string | Yes | No | Preferences directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory.|
| distributedFilesDir | string | Yes | No | Distributed file directory.|
| eventHub |
string
| Yes | No | Event hub that implements event subscription, unsubscription, and triggering.|
| area |
[
AreaMode
](
#areamode
)
| Yes | No | Area in which the file to be access is located.|
| eventHub |
[
EventHub
](
js-apis-inner-application-eventHub.md
)
| Yes | No | Event hub that implements event subscription, unsubscription, and triggering.|
| area |
contextConstant.
[
AreaMode
](
js-apis-app-ability-contextConstant.md
)
| Yes | No | Area in which the file to be access is located.|
## Context.createBundleContext
...
...
@@ -60,7 +60,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```
ts
let
bundleContext
;
try
{
bundleContext
=
this
.
context
.
createBundleContext
(
"
com.example.test
"
);
bundleContext
=
this
.
context
.
createBundleContext
(
'
com.example.test
'
);
}
catch
(
error
)
{
console
.
log
(
'
createBundleContext failed, error.code:
'
+
JSON
.
stringify
(
error
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
...
...
@@ -100,7 +100,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```
ts
let
moduleContext
;
try
{
moduleContext
=
this
.
context
.
createModuleContext
(
"
entry
"
);
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry
'
);
}
catch
(
error
)
{
console
.
log
(
'
createModuleContext failed, error.code:
'
+
JSON
.
stringify
(
error
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
...
...
@@ -139,7 +139,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```
ts
let
moduleContext
;
try
{
moduleContext
=
this
.
context
.
createModuleContext
(
"
com.example.test
"
,
"
entry
"
);
moduleContext
=
this
.
context
.
createModuleContext
(
'
com.example.test
'
,
'
entry
'
);
}
catch
(
error
)
{
console
.
log
(
'
createModuleContext failed, error.code:
'
+
JSON
.
stringify
(
error
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
...
...
@@ -171,14 +171,3 @@ try {
'
error.message:
'
+
JSON
.
stringify
(
error
.
message
));
}
```
## AreaMode
Enumerates the areas in which the file to be access can be located.
**System capability**
: SystemCapability.Ability.AbilityRuntime.Core
| Name| Value| Description|
| -------- | -------- | -------- |
| EL1 | 0 | Device-level encryption area, which is accessible after the device is powered on.|
| EL2 | 1 | User-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time).|
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录