未验证 提交 7c831620 编写于 作者: O openharmony_ci 提交者: Gitee

!15012 翻译完成:13891 Context文档描述修复

Merge pull request !15012 from wusongqing/TR13891
...@@ -22,8 +22,8 @@ The **Context** module provides context for abilities or applications. It allows ...@@ -22,8 +22,8 @@ The **Context** module provides context for abilities or applications. It allows
| preferencesDir | string | Yes | No | Preferences directory.| | preferencesDir | string | Yes | No | Preferences directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory.| | bundleCodeDir | string | Yes | No | Bundle code directory.|
| distributedFilesDir | string | Yes | No | Distributed file directory.| | distributedFilesDir | string | Yes | No | Distributed file directory.|
| eventHub | string | Yes | No | Event hub that implements event subscription, unsubscription, and triggering.| | eventHub | [EventHub](js-apis-inner-application-eventHub.md) | 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.| | area | contextConstant.[AreaMode](js-apis-app-ability-contextConstant.md) | Yes | No | Area in which the file to be access is located.|
## Context.createBundleContext ## Context.createBundleContext
...@@ -60,7 +60,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -60,7 +60,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
let bundleContext; 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) + console.log('createBundleContext failed, error.code: ' + JSON.stringify(error.code) +
' error.message: ' + JSON.stringify(error.message)); ' error.message: ' + JSON.stringify(error.message));
...@@ -100,7 +100,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -100,7 +100,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
let moduleContext; 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) + console.log('createModuleContext failed, error.code: ' + JSON.stringify(error.code) +
' error.message: ' + JSON.stringify(error.message)); ' error.message: ' + JSON.stringify(error.message));
...@@ -139,7 +139,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -139,7 +139,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
let moduleContext; 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) + console.log('createModuleContext failed, error.code: ' + JSON.stringify(error.code) +
' error.message: ' + JSON.stringify(error.message)); ' error.message: ' + JSON.stringify(error.message));
...@@ -171,14 +171,3 @@ try { ...@@ -171,14 +171,3 @@ try {
' error.message: ' + JSON.stringify(error.message)); ' 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.
先完成此消息的编辑!
想要评论请 注册