Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
256661fc
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看板
未验证
提交
256661fc
编写于
7月 03, 2023
作者:
M
MangTsang
提交者:
Gitee
7月 03, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update reivews
Signed-off-by:
N
MangTsang
<
mang.tsang@huawei.com
>
上级
0903218b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
27 deletion
+27
-27
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
...pplication-dev/reference/apis/js-apis-data-preferences.md
+27
-27
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
浏览文件 @
256661fc
...
@@ -310,7 +310,7 @@ class EntryAbility extends UIAbility {
...
@@ -310,7 +310,7 @@ class EntryAbility extends UIAbility {
removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback
<
void
>
): void
removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback
<
void
>
): void
从
内
存中移除指定的Preferences实例,使用callback异步回调。
从
缓
存中移除指定的Preferences实例,使用callback异步回调。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
...
@@ -373,7 +373,7 @@ class EntryAbility extends UIAbility {
...
@@ -373,7 +373,7 @@ class EntryAbility extends UIAbility {
removePreferencesFromCache(context: Context, name: string): Promise
<
void
>
removePreferencesFromCache(context: Context, name: string): Promise
<
void
>
从
内
存中移除指定的Preferences实例,使用Promise异步回调。
从
缓
存中移除指定的Preferences实例,使用Promise异步回调。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
...
@@ -438,7 +438,7 @@ class EntryAbility extends UIAbility {
...
@@ -438,7 +438,7 @@ class EntryAbility extends UIAbility {
removePreferencesFromCacheSync(context: Context, name: string): void
removePreferencesFromCacheSync(context: Context, name: string): void
从
内
存中移除指定的Preferences实例,此为同步接口。
从
缓
存中移除指定的Preferences实例,此为同步接口。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
调用该接口后,应用不允许再使用该Preferences实例进行数据操作,否则会出现数据一致性问题。
...
@@ -485,7 +485,7 @@ class EntryAbility extends UIAbility {
...
@@ -485,7 +485,7 @@ class EntryAbility extends UIAbility {
## Preferences
## Preferences
存储
实例,提供获取和修改存储数据的接口。
首选项
实例,提供获取和修改存储数据的接口。
下列接口都需先使用
[
data_preferences.getPreferences
](
#data_preferencesgetpreferences
)
获取到Preferences实例,再通过此实例调用对应接口。
下列接口都需先使用
[
data_preferences.getPreferences
](
#data_preferencesgetpreferences
)
获取到Preferences实例,再通过此实例调用对应接口。
...
@@ -494,7 +494,7 @@ class EntryAbility extends UIAbility {
...
@@ -494,7 +494,7 @@ class EntryAbility extends UIAbility {
get(key: string, defValue: ValueType, callback: AsyncCallback
<
ValueType
>
): void
get(key: string, defValue: ValueType, callback: AsyncCallback
<
ValueType
>
): void
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,使用callback异步回调。
从缓存的Preferences实例中
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -527,7 +527,7 @@ try {
...
@@ -527,7 +527,7 @@ try {
get(key: string, defValue: ValueType): Promise
<
ValueType
>
get(key: string, defValue: ValueType): Promise
<
ValueType
>
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,使用Promise异步回调。
从缓存的Preferences实例中
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -563,7 +563,7 @@ try {
...
@@ -563,7 +563,7 @@ try {
getSync(key: string, defValue: ValueType): ValueType
getSync(key: string, defValue: ValueType): ValueType
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,此为同步接口。
从缓存的Preferences实例中
获取键对应的值,如果值为null或者非默认值类型,返回默认数据defValue,此为同步接口。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -595,7 +595,7 @@ try {
...
@@ -595,7 +595,7 @@ try {
getAll(callback: AsyncCallback
<
Object
>
): void;
getAll(callback: AsyncCallback
<
Object
>
): void;
获取含有所有键值的Object对象
。
从缓存的Preferences实例中获取所有键值数据
。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -603,7 +603,7 @@ getAll(callback: AsyncCallback<Object>): void;
...
@@ -603,7 +603,7 @@ getAll(callback: AsyncCallback<Object>): void;
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback
<
Object
>
| 是 | 回调函数。当获取成功,err为undefined,value为
含有所有键值的Object对象
;否则err为错误码。 |
| callback | AsyncCallback
<
Object
>
| 是 | 回调函数。当获取成功,err为undefined,value为
所有键值数据
;否则err为错误码。 |
**示例:**
**示例:**
...
@@ -628,7 +628,7 @@ try {
...
@@ -628,7 +628,7 @@ try {
getAll(): Promise
<
Object
>
getAll(): Promise
<
Object
>
获取含有所有键值的Object对象
。
从缓存的Preferences实例中获取所有键值数据
。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -636,7 +636,7 @@ getAll(): Promise<Object>
...
@@ -636,7 +636,7 @@ getAll(): Promise<Object>
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ------------------------------------------- |
| --------------------- | ------------------------------------------- |
| Promise
<
Object
>
| Promise对象,返回含有所有键值
的Object对象
。 |
| Promise
<
Object
>
| Promise对象,返回含有所有键值
数据
。 |
**示例:**
**示例:**
...
@@ -659,7 +659,7 @@ try {
...
@@ -659,7 +659,7 @@ try {
getAllSync(): Object
getAllSync(): Object
获取含有所有键值的Object对象
,此为同步接口。
从缓存的Preferences实例中获取所有键值数据。
,此为同步接口。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -667,7 +667,7 @@ getAllSync(): Object
...
@@ -667,7 +667,7 @@ getAllSync(): Object
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ------------------------------------------- |
| --------------------- | ------------------------------------------- |
| Object | 返回含有所有键值
的Object对象
。 |
| Object | 返回含有所有键值
数据
。 |
**示例:**
**示例:**
...
@@ -686,7 +686,7 @@ try {
...
@@ -686,7 +686,7 @@ try {
put(key: string, value: ValueType, callback: AsyncCallback
<
void
>
): void
put(key: string, value: ValueType, callback: AsyncCallback
<
void
>
): void
将数据写入
Preferences实例
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,使用callback异步回调。
将数据写入
缓存的Preferences实例中
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -719,7 +719,7 @@ try {
...
@@ -719,7 +719,7 @@ try {
put(key: string, value: ValueType): Promise
<
void
>
put(key: string, value: ValueType): Promise
<
void
>
将数据写入
Preferences实例
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,使用Promise异步回调。
将数据写入
缓存的Preferences实例中
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -756,7 +756,7 @@ try {
...
@@ -756,7 +756,7 @@ try {
putSync(key: string, value: ValueType): void
putSync(key: string, value: ValueType): void
将数据写入
Preferences实例
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,此为同步接口。
将数据写入
缓存的Preferences实例中
,可通过
[
flush
](
#flush
)
将Preferences实例持久化,此为同步接口。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -782,7 +782,7 @@ try {
...
@@ -782,7 +782,7 @@ try {
has(key: string, callback: AsyncCallback
<
boolean
>
): void
has(key: string, callback: AsyncCallback
<
boolean
>
): void
检查
Preferences实例
是否包含名为给定Key的存储键值对,使用callback异步回调。
检查
缓存的Preferences实例中
是否包含名为给定Key的存储键值对,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -818,7 +818,7 @@ try {
...
@@ -818,7 +818,7 @@ try {
has(key: string): Promise
<
boolean
>
has(key: string): Promise
<
boolean
>
检查
Preferences实例
是否包含名为给定Key的存储键值对,使用Promise异步回调。
检查
缓存的Preferences实例中
是否包含名为给定Key的存储键值对,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -858,7 +858,7 @@ try {
...
@@ -858,7 +858,7 @@ try {
hasSync(key: string): boolean
hasSync(key: string): boolean
检查
Preferences实例
是否包含名为给定Key的存储键值对,此为同步接口。
检查
缓存的Preferences实例中
是否包含名为给定Key的存储键值对,此为同步接口。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -894,7 +894,7 @@ try {
...
@@ -894,7 +894,7 @@ try {
delete(key: string, callback: AsyncCallback
<
void
>
): void
delete(key: string, callback: AsyncCallback
<
void
>
): void
从
Preferences实例中删除名为给定Key的存储键值对
,使用callback异步回调。
从
缓存的Preferences实例中删除名为给定Key的存储键值对,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -926,7 +926,7 @@ try {
...
@@ -926,7 +926,7 @@ try {
delete(key: string): Promise
<
void
>
delete(key: string): Promise
<
void
>
从
Preferences实例中删除名为给定Key的存储键值对
,使用Promise异步回调。
从
缓存的Preferences实例中删除名为给定Key的存储键值对,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -962,7 +962,7 @@ try {
...
@@ -962,7 +962,7 @@ try {
deleteSync(key: string): void
deleteSync(key: string): void
从
Preferences实例中删除名为给定Key的存储键值对
,此为同步接口。
从
缓存的Preferences实例中删除名为给定Key的存储键值对,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,此为同步接口。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -987,7 +987,7 @@ try {
...
@@ -987,7 +987,7 @@ try {
flush(callback: AsyncCallback
<
void
>
): void
flush(callback: AsyncCallback
<
void
>
): void
将
当前Preferences实例
的数据异步存储到用户首选项的持久化文件中,使用callback异步回调。
将
缓存的Preferences实例中
的数据异步存储到用户首选项的持久化文件中,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -1018,7 +1018,7 @@ try {
...
@@ -1018,7 +1018,7 @@ try {
flush(): Promise
<
void
>
flush(): Promise
<
void
>
将
当前Preferences实例
的数据异步存储到用户首选项的持久化文件中,使用Promise异步回调。
将
缓存的Preferences实例中
的数据异步存储到用户首选项的持久化文件中,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -1048,7 +1048,7 @@ try {
...
@@ -1048,7 +1048,7 @@ try {
clear(callback: AsyncCallback
<
void
>
): void
clear(callback: AsyncCallback
<
void
>
): void
清除
此Preferences实例中的所有存储
,使用callback异步回调。
清除
缓存的Preferences实例中的所有数据,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,使用callback异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -1079,7 +1079,7 @@ try {
...
@@ -1079,7 +1079,7 @@ try {
clear(): Promise
<
void
>
clear(): Promise
<
void
>
清除
此Preferences实例中的所有存储
,使用Promise异步回调。
清除
缓存的Preferences实例中的所有数据,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,使用Promise异步回调。
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
**系统能力:**
SystemCapability.DistributedDataManager.Preferences.Core
...
@@ -1109,7 +1109,7 @@ try {
...
@@ -1109,7 +1109,7 @@ try {
clearSync(): void
clearSync(): void
清除
此Preferences实例中的所有存储
,此为同步接口。
清除
缓存的Preferences实例中的所有数据,可通过
[
flush
](
#flush
)
将Preferences实例持久化
,此为同步接口。
**系统能力:**
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录