diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md index 68da7c3cd1a2d885314d18b84c629fdecdd8f96f..d7fad75e68111100e32c4fc02cd4c0a2ddc05c3e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @@ -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 - 参数: | 参数名 | 类型 | 说明 |