From 04743dc82a3e0f1072a2b0bde28a1512df74660f Mon Sep 17 00:00:00 2001 From: esterzhou Date: Mon, 21 Mar 2022 00:21:40 +0800 Subject: [PATCH] update doc Signed-off-by: esterzhou --- .../reference/apis/js-apis-settings.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index bc2b4d022a..b402daf3f9 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -1,6 +1,6 @@ # Settings -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -14,10 +14,6 @@ import settings from '@ohos.settings'; ``` -## Required Permissions - -None - ## settings.getUriSync @@ -25,10 +21,12 @@ getUriSync(name: string): string Obtains the URI of a data item. +**System capability**: SystemCapability.Applictaions.settings.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| - Return value | Type| Description| @@ -48,11 +46,13 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin Obtains the value of a data item. +**System capability**: SystemCapability.Applictaions.settings.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| | defValue | string | Yes| Default value This parameter is user-defined. If it is not found in the database, the default value is returned.| - Return value @@ -63,7 +63,7 @@ Obtains the value of a data item. - Example ``` import featureAbility from '@ohos.featureAbility'; - + // Obtain the value of 'settings.screen.brightness' (this data item already exists in the database). let brightness = 'settings.screen.brightness'; let uri = settings.getUriSync(brightness); @@ -79,13 +79,15 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): Sets the value of a data item. If the specified data item exists in the database, the **setValueSync** method updates the value of the data item. If the data item does not exist in the database, the **setValueSync** method inserts the data item into the database. -To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** permission. +**Required permissions**: ohos.permission.WRITE_SYSTEM_SETTING + +**System capability**: SystemCapability.Applictaions.settings.Core - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| | value | string | Yes| Value of the data item.| - Return value @@ -96,7 +98,7 @@ To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** p - Example ``` import featureAbility from '@ohos.featureAbility'; - + // Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync method will update the value of the data item.) let brightness = 'settings.screen.brightness'; -- GitLab