diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index 82ae2c2f0c346f80cf133ec75700a78ff4cb59c1..9b56d25f9f841be73f607a6ef249d57c3f3f3a8d 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -9,7 +9,7 @@ This module provides APIs for setting data items. ## Modules to Import -``` +```typescript import settings from '@ohos.settings'; ``` @@ -34,7 +34,7 @@ Obtains the URI of a data item. | string | URI of the data item.| - Example - ``` + ```typescript // Obtain the URI of a data item. let urivar = settings.getUriSync('settings.screen.brightness'); ``` @@ -61,7 +61,7 @@ Obtains the value of a data item. | string | Value of the data item.| - Example - ``` + ```typescript import featureAbility from '@ohos.featureAbility'; // Obtain the value of 'settings.screen.brightness' (this data item already exists in the database). @@ -96,7 +96,7 @@ If the specified data item exists in the database, the **setValueSync** method u | boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.| - Example - ``` + ```typescript import featureAbility from '@ohos.featureAbility'; // Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync diff --git a/zh-cn/application-dev/reference/apis/js-apis-settings.md b/zh-cn/application-dev/reference/apis/js-apis-settings.md index 20e07393953849127eaddf314ce2a7142028f825..80f832bab548df8fa5945458e8f0c20b94991a8c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-settings.md +++ b/zh-cn/application-dev/reference/apis/js-apis-settings.md @@ -9,7 +9,7 @@ ## 导入模块 -``` +```typescript import settings from '@ohos.settings'; ``` @@ -34,7 +34,7 @@ getUriSync(name: string): string | string | 数据项的URI。 | - 示例: - ``` + ```typescript // 获取数据项的URI let urivar = settings.getUriSync('settings.screen.brightness'); ``` @@ -61,7 +61,7 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin | string | 返回数据项的值。 | - 示例: - ``` + ```typescript import featureAbility from '@ohos.featureAbility'; //获取数据项亮度的值(该数据项在数据库中已存在) @@ -96,7 +96,7 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): | boolean | 返回设置数据项的值是否成功的结果。true表示设置成功,false则表示设置失败。 | - 示例: - ``` + ```typescript import featureAbility from '@ohos.featureAbility'; //更新数据项亮度的值(该数据项在数据库中已存在,故setValueSync方法将更新该数据项的值)