Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
eebf0cf0
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看板
未验证
提交
eebf0cf0
编写于
3月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1792 修改错误的格式
Merge pull request !1792 from PaDaBoo/master
上级
2c3050ee
26a59deb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
42 deletion
+23
-42
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
...pplication-dev/reference/apis/js-apis-data-preferences.md
+23
-42
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
浏览文件 @
eebf0cf0
...
...
@@ -27,8 +27,8 @@ getPreferences(context: Context, name: string, callback: AsyncCallback<Prefer
读取指定文件,将数据加载到Preferences实例,用于数据操作,使用callback形式返回结果。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:
SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -41,7 +41,7 @@ SystemCapability.DistributedDataManager.Preferences.Core
```
import Ability from '@ohos.application.Ability'
import data_Preferences from '@ohos.data.preferences'
var path =
await
this.context.getDataBaseDir()
var path = this.context.getDataBaseDir()
data_Preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
if (err) {
console.info("Get the preferences failed, path: " + path + '/mystore')
...
...
@@ -59,8 +59,7 @@ getPreferences(context: Context, name: string): Promise<Preferences>
读取指定文件,将数据加载到Preferences实例,用于数据操作,使用Promise方式作为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -77,7 +76,7 @@ SystemCapability.DistributedDataManager.Preferences.Core
```
import Ability from '@ohos.application.Ability'
import data_Preferences from '@ohos.data.preferences'
var path =
await
this.context.getDataBaseDir()
var path = this.context.getDataBaseDir()
let promise = data_Preferences.getPreferences(this.context, 'mystore')
promise.then((preferences) => {
preferences.putSync('startup', 'auto')
...
...
@@ -94,8 +93,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback<voi
从内存中移除指定文件对应的Preferences单实例,并删除指定文件及其备份文件、损坏文件。删除指定文件时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,使用callback方式作为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -124,8 +122,7 @@ deletePreferences(context: Context, name: string): Promise<void>
从内存中移除指定文件对应的Preferences单实例,并删除指定文件及其备份文件、损坏文件。删除指定文件时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,使用promise方式作为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -159,8 +156,7 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -191,8 +187,7 @@ removePreferencesFromCache(context: Context, name: string): Promise<void>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -231,8 +226,7 @@ get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>):
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -261,8 +255,7 @@ get(key: string, defValue: ValueType): Promise<ValueType>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -294,8 +287,7 @@ put(key: string, value: ValueType, callback: AsyncCallback<void>): void
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -324,8 +316,7 @@ put(key: string, value: ValueType): Promise<void>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -357,8 +348,7 @@ has(key: string, callback: AsyncCallback<boolean>): boolean
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -393,8 +383,7 @@ has(key: string): Promise<boolean>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -427,8 +416,7 @@ delete(key: string, callback: AsyncCallback<void>): void
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -456,8 +444,7 @@ delete(key: string): Promise<void>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -488,8 +475,7 @@ flush(callback: AsyncCallback<void>): void
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -516,8 +502,7 @@ flush(): Promise<void>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
返回值:
| 类型 | 说明 |
...
...
@@ -543,8 +528,7 @@ clear(callback: AsyncCallback<void>): void
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -571,8 +555,7 @@ clear(): Promise<void>
此方法为异步方法。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
返回值:
| 类型 | 说明 |
...
...
@@ -596,8 +579,7 @@ on(type: 'change', callback: Callback<{ key : string }>): void
订阅数据变更者类,订阅的key的值发生变更后,在执行flush方法后,callback方法会被回调。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 说明 |
...
...
@@ -622,8 +604,7 @@ off(type: 'change', callback: Callback<{ key : string }>): void
当不再进行订阅数据变更时,使用此接口取消订阅。
### 系统能力###
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力**
:SystemCapability.DistributedDataManager.Preferences.Core
-
参数:
| 参数名 | 类型 | 说明 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录