Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7230c3f4
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看板
未验证
提交
7230c3f4
编写于
7月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6300 【文档体验官】3.1分支存在冗余API:js-apis-applicationContext和js-apis-application-context
Merge pull request !6300 from Conner_hu/OpenHarmony-3.1-Release
上级
5a67e803
77dffa82
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
136 deletion
+58
-136
zh-cn/application-dev/reference/apis/js-apis-application-context.md
...ication-dev/reference/apis/js-apis-application-context.md
+58
-20
zh-cn/application-dev/reference/apis/js-apis-applicationContext.md
...lication-dev/reference/apis/js-apis-applicationContext.md
+0
-116
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-application-context.md
浏览文件 @
7230c3f4
...
...
@@ -18,18 +18,18 @@
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | 是 | 否 | ResourceManager对象。 |
| applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 |
| cacheDir | string | 是 | 否 | 应用在内部存储上的缓存路径。 |
| tempDir | string | 是 | 否 | 应用的临时文件路径。 |
| filesDir | string | 是 | 否 | 应用在内部存储上的文件路径。 |
| databaseDir | string | 是 | 否 | 获取本地数据存储路径。 |
| storageDir | string | 是 | 否 | 获取轻量级数据存储路径。 |
| bundleCodeDir | string | 是 | 否 | 应用安装路径。 |
| distributedFilesDir | string | 是 | 否 | 应用的分布式文件路径。 |
| eventHub |
[
EventHub
](
js-apis-eventhub.md
)
| 是 | 否 | 事件中心信息。|
| resourceManager | ResourceManager | 是 | 否 | ResourceManager对象。 |
| applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 |
| cacheDir | string | 是 | 否 | 应用在内部存储上的缓存路径。 |
| tempDir | string | 是 | 否 | 应用的临时文件路径。 |
| filesDir | string | 是 | 否 | 应用在内部存储上的文件路径。 |
| databaseDir | string | 是 | 否 | 获取本地数据存储路径。 |
| storageDir | string | 是 | 否 | 获取轻量级数据存储路径。 |
| bundleCodeDir | string | 是 | 否 | 应用安装路径。 |
| distributedFilesDir | string | 是 | 否 | 应用的分布式文件路径。 |
| eventHub |
[
EventHub
](
js-apis-eventhub.md
)
| 是 | 否 | 事件中心信息。|
## Context.createBundleContext
...
...
@@ -42,15 +42,15 @@ createBundleContext(bundleName: string): Context;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 应用bundle名。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 应用bundle名。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 对应创建应用的上下文context。 |
| 类型 | 说明 |
| -------- | -------- |
| Context | 对应创建应用的上下文context。 |
**示例:**
...
...
@@ -70,13 +70,51 @@ getApplicationContext(): Context;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 当前Context
信息。 |
| 类型 | 说明 |
| -------- | -------- |
| Context | 当前Context
信息。 |
**示例:**
```
js
// 必选项。
let
context
=
this
.
context
.
getApplicationContext
();
```
> **说明:**
> 当SDK :API 9版本为Canary版本时;
## Context.switchArea
switchArea(mode: AreaMode): void
开启文件范围
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | --------------------- | ---- | -------------- |
| mode |
[
AreaMode
](
#AreaMode
)
| 是 | 应用bundle名。 |
**示例**
:
```
js
var
areaMode
=
0
this
.
context
.
switchArea
(
areaMode
);
```
## AreaMode
文件范围模式
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 参数类型 | 值 |
| ---- | -------- | ---- |
| EL1 | number | 0 |
| EL2 | number | 1 |
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-applicationContext.md
已删除
100644 → 0
浏览文件 @
5a67e803
# Context
>  **说明**
>
> 本模块首批接口从API version 9开始支持。API 9当前为Canary版本,仅供使用,不保证接口可稳定调用。
提供开发者运行代码的上下文环境,包括应用信息、ResourceManager等信息。
## 使用说明
通过AbilityContext等继承实现。
## 属性
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | 是 | 否 | ResourceManager对象。 |
| applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 |
| cacheDir | string | 是 | 否 | 应用在内部存储上的缓存路径。 |
| tempDir | string | 是 | 否 | 应用的临时文件路径。 |
| filesDir | string | 是 | 否 | 应用在内部存储上的文件路径。 |
| databaseDir | string | 是 | 否 | 获取本地数据存储路径。 |
| storageDir | string | 是 | 否 | 获取轻量级数据存储路径。 |
| bundleCodeDir | string | 是 | 否 | 应用安装路径。 |
| distributedFilesDir | string | 是 | 否 | 应用的分布式文件路径。 |
| eventHub |
[
EventHub
](
js-apis-eventhub.md
)
| 是 | 否 | 事件中心信息。|
## Context.createBundleContext
createBundleContext(bundleName: string): Context;
创建指定应用上下文。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 应用bundle名。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 对应创建应用的上下文context。 |
**示例:**
```
js
let
test
=
"
com.example.test
"
;
let
context
=
this
.
context
.
createBundleContext
(
test
);
```
## Context.getApplicationContext
getApplicationContext(): Context;
获取当前context。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 当前Context
信息。 |
**示例:**
```
js
// 必选项。
let
context
=
this
.
context
.
getApplicationContext
();
```
## Context.switchArea
switchArea(mode: AreaMode): void
开启文件范围
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| mode |
[
AreaMode
](
#AreaMode
)
| 是 | 应用bundle名。 |
**示例**
:
```
js
var
areaMode
=
0
this
.
context
.
switchArea
(
areaMode
);
```
## AreaMode
文件范围模式
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 参数类型 | 值 |
| -------- | -------- | -------- |
| EL1 | number | 0 |
| EL2 | number | 1 |
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录