Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d2b7934f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2b7934f
编写于
3月 18, 2022
作者:
P
PaDoBoo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ohos Handling API interface integrity and consistency
Signed-off-by:
N
PaDoBoo
<
xuejianwu@huawei.com
>
上级
114289f0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
36 deletion
+36
-36
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
...pplication-dev/reference/apis/js-apis-data-preferences.md
+18
-18
zh-cn/application-dev/reference/apis/js-apis-data-storage.md
zh-cn/application-dev/reference/apis/js-apis-data-storage.md
+18
-18
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
浏览文件 @
d2b7934f
...
...
@@ -79,8 +79,8 @@ getPreferences(context: Context, name: string): Promise<Preferences>
import Ability from '@ohos.application.Ability'
import data_Preferences from '@ohos.data.preferences'
var path = this.context.getDataBaseDir()
let promise = data_Preferences.getPreferences(this.context, 'mystore')
promise.then((preferences) => {
let promise
Pre
= data_Preferences.getPreferences(this.context, 'mystore')
promise
Pre
.then((preferences) => {
preferences.putSync('startup', 'auto')
preferences.flushSync()
}).catch((err) => {
...
...
@@ -141,8 +141,8 @@ deletePreferences(context: Context, name: string): Promise<void>
```
import Ability from '@ohos.application.Ability'
import data_Preferences from '@ohos.data.preferences'
let promise = data_Preferences.deletePreferences(this.context, 'mystore')
promise.then(() => {
let promise
delPre
= data_Preferences.deletePreferences(this.context, 'mystore')
promise
delPre
.then(() => {
console.info("Deleted successfully.")
}).catch((err) => {
console.info("Deleted failed with err: " + err)
...
...
@@ -206,8 +206,8 @@ removePreferencesFromCache(context: Context, name: string): Promise<void>
```
import Ability from '@ohos.application.Ability'
import data_Preferences from '@ohos.data.preferences'
let promise = data_Preferences.removePreferencesFromCache(this.context, 'mystore')
promise.then(() => {
let promise
revPre
= data_Preferences.removePreferencesFromCache(this.context, 'mystore')
promise
revPre
.then(() => {
console.info("Removed preferences from cache successfully.")
}).catch((err) => {
console.info("Removed preferences from cache failed with err: " + err)
...
...
@@ -272,8 +272,8 @@ get(key: string, defValue: ValueType): Promise<ValueType>
-
示例:
```
let promise = preferences.get('startup', 'default')
promise.then((value) => {
let promise
get
= preferences.get('startup', 'default')
promise
get
.then((value) => {
console.info("The value of startup is " + value)
}).catch((err) => {
console.info("Get the value of startup failed with err: " + err)
...
...
@@ -333,8 +333,8 @@ put(key: string, value: ValueType): Promise<void>
-
示例:
```
let promise = preferences.put('startup', 'auto')
promise.then(() => {
let promise
put
= preferences.put('startup', 'auto')
promise
put
.then(() => {
console.info("Put the value of startup successfully.")
}).catch((err) => {
console.info("Put the value of startup failed with err: " + err)
...
...
@@ -399,8 +399,8 @@ has(key: string): Promise<boolean>
-
示例:
```
let promise = preferences.has('startup')
promise.then((isExist) => {
let promise
has
= preferences.has('startup')
promise
has
.then((isExist) => {
if (isExist) {
console.info("The key of startup is contained.")
}
...
...
@@ -460,8 +460,8 @@ delete(key: string): Promise<void>
-
示例:
```
let promise = preferences.delete('startup')
promise.then(() => {
let promise
del
= preferences.delete('startup')
promise
del
.then(() => {
console.info("Deleted startup key successfully.")
}).catch((err) => {
console.info("Delete startup key failed with err: " + err)
...
...
@@ -513,8 +513,8 @@ flush(): Promise<void>
-
示例:
```
let promise = preferences.flush()
promise.then(() => {
let promise
flush
= preferences.flush()
promise
flush
.then(() => {
console.info("Flushed to file successfully.")
}).catch((err) => {
console.info("Flush to file failed with err: " + err)
...
...
@@ -566,8 +566,8 @@ clear(): Promise<void>
-
示例:
```
let promise = preferences.clear()
promise.then(() => {
let promise
clear
= preferences.clear()
promise
clear
.then(() => {
console.info("Cleared to file successfully.")
}).catch((err) => {
console.info("Clear to file failed with err: " + err)
...
...
zh-cn/application-dev/reference/apis/js-apis-data-storage.md
浏览文件 @
d2b7934f
...
...
@@ -111,8 +111,8 @@ getStorage(path: string): Promise<Storage>
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let promise = dataStorage.getStorage(path + '/mystore')
promise.then((storage) => {
let promise
getSt
= dataStorage.getStorage(path + '/mystore')
promise
getSt
.then((storage) => {
storage.putSync('startup', 'auto')
storage.flushSync()
}).catch((err) => {
...
...
@@ -186,8 +186,8 @@ deleteStorage(path: string): Promise<void>
-
示例:
```
let promise = dataStorage.deleteStorage(path + '/mystore')
promise.then(() => {
let promise
delSt
= dataStorage.deleteStorage(path + '/mystore')
promise
delSt
.then(() => {
console.info("Deleted successfully.")
}).catch((err) => {
console.info("Deleted failed with err: " + err)
...
...
@@ -266,8 +266,8 @@ removeStorageFromCache(path: string): Promise<void>
-
示例:
```
let promise = dataStorage.removeStorageFromCache(path + '/mystore')
promise.then(() => {
let promise
revSt
= dataStorage.removeStorageFromCache(path + '/mystore')
promise
revSt
.then(() => {
console.info("Removed storage from cache successfully.")
}).catch((err) => {
console.info("Removed storage from cache failed with err: " + err)
...
...
@@ -360,8 +360,8 @@ get(key: string, defValue: ValueType): Promise<ValueType>
-
示例:
```
let promise = storage.get('startup', 'default')
promise.then((value) => {
let promise
get
= storage.get('startup', 'default')
promise
get
.then((value) => {
console.info("The value of startup is " + value)
}).catch((err) => {
console.info("Get the value of startup failed with err: " + err)
...
...
@@ -443,8 +443,8 @@ put(key: string, value: ValueType): Promise<void>
-
示例:
```
let promise = storage.put('startup', 'auto')
promise.then(() => {
let promise
put
= storage.put('startup', 'auto')
promise
put
.then(() => {
console.info("Put the value of startup successfully.")
}).catch((err) => {
console.info("Put the value of startup failed with err: " + err)
...
...
@@ -538,8 +538,8 @@ has(key: string): Promise<boolean>
-
示例:
```
let promise = storage.has('startup')
promise.then((isExist) => {
let promise
has
= storage.has('startup')
promise
has
.then((isExist) => {
if (isExist) {
console.info("The key of startup is contained.")
}
...
...
@@ -620,8 +620,8 @@ delete(key: string): Promise<void>
-
示例:
```
let promise = storage.delete('startup')
promise.then(() => {
let promise
del
= storage.delete('startup')
promise
del
.then(() => {
console.info("Deleted startup key successfully.")
}).catch((err) => {
console.info("Delete startup key failed with err: " + err)
...
...
@@ -689,8 +689,8 @@ flush(): Promise<void>
-
示例:
```
let promise = storage.flush()
promise.then(() => {
let promise
flush
= storage.flush()
promise
flush
.then(() => {
console.info("Flushed to file successfully.")
}).catch((err) => {
console.info("Flush to file failed with err: " + err)
...
...
@@ -758,8 +758,8 @@ clear(): Promise<void>
-
示例:
```
let promise = storage.clear()
promise.then(() => {
let promise
clear
= storage.clear()
promise
clear
.then(() => {
console.info("Cleared to file successfully.")
}).catch((err) => {
console.info("Clear to file failed with err: " + err)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录