diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index 84c909151c43f5420fcb130403a4734db7c54f35..83b3ac3920ac5fe6bca78974f664174157da86b0 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** +> **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. @@ -23,21 +23,24 @@ 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:
| +**Parameters** -- Return value - | Type| Description| - | -------- | -------- | - | string | URI of the data item.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| name | string | Yes| Name of the target data item. Data items can be classified as follows:
| -- Example - ```typescript - // Obtain the URI of a data item. - let urivar = settings.getUriSync('settings.screen.brightness'); - ``` +**Return value** + +| Type| Description| +| -------- | -------- | +| string | URI of the data item.| + +**Example** + +```typescript + // Obtain the URI of a data item. + let urivar = settings.getUriSync('settings.screen.brightness'); +``` ## settings.getValueSync @@ -48,28 +51,30 @@ 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:
| - | defValue | string | Yes| Default value This parameter is user-defined. If it is not found in the database, the default value is returned.| +**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:
| +| 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** + +| Type| Description| +| -------- | -------- | +| string | Value of the data item.| -- Return value - | Type| Description| - | -------- | -------- | - | string | Value of the data item.| +**Example** -- Example - ```typescript +```typescript import featureAbility from '@ohos.ability.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); - let helper = featureAbility.acquireDataAbilityHelper(uri); - let value = settings.getValueSync(helper, brightness, '10'); - ``` +// 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); +let helper = featureAbility.acquireDataAbilityHelper(uri); +let value = settings.getValueSync(helper, brightness, '10'); +``` ## settings.setValueSync @@ -77,32 +82,36 @@ Obtains the value of a data item. setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean 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. **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:
| - | value | string | Yes| Value of the data item.| +**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:
| +| value | string | Yes| Value of the data item.| -- Return value - | Type| Description| - | -------- | -------- | - | boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.| +**Return value** -- Example - ```typescript +| Type| Description| +| -------- | -------- | +| 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.ability.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'; - let uri = settings.getUriSync(brightness); - let helper = featureAbility.acquireDataAbilityHelper(uri); - let ret = settings.setValueSync(helper, brightness, '100'); - ``` +// 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'; +let uri = settings.getUriSync(brightness); +let helper = featureAbility.acquireDataAbilityHelper(uri); +let ret = settings.setValueSync(helper, brightness, '100'); +``` \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-system-parameter.md b/en/application-dev/reference/apis/js-apis-system-parameter.md index c068d0429fcd2aa1ee91fb3dd145ee32296274e8..999c894303b070539e3fdc5c4010aaa0a5f19803 100644 --- a/en/application-dev/reference/apis/js-apis-system-parameter.md +++ b/en/application-dev/reference/apis/js-apis-system-parameter.md @@ -1,7 +1,6 @@ # System Parameter > **NOTE**
-> > - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - This is a system API and cannot be called by third-party applications. @@ -49,7 +48,7 @@ try { get(key: string, callback: AsyncCallback<string>): void -Obtains the value of the attribute with the specified key. +Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Startup.SysInfo @@ -80,7 +79,7 @@ try { get(key: string, def: string, callback: AsyncCallback<string>): void -Obtains the value of the attribute with the specified key. +Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Startup.SysInfo @@ -89,7 +88,7 @@ Obtains the value of the attribute with the specified key. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the system attribute.| -| def | string | Yes| Default Value| +| def | string | Yes| Default value.| | callback | AsyncCallback<string> | Yes| Callback used to return the result.| **Example** @@ -113,7 +112,7 @@ try { get(key: string, def?: string): Promise<string> -Obtains the value of the attribute with the specified key. +Obtains the value of the attribute with the specified key. This API uses a promise to return the result. **System capability**: SystemCapability.Startup.SysInfo @@ -122,7 +121,7 @@ Obtains the value of the attribute with the specified key. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the system attribute.| -| def | string | No| Default Value| +| def | string | No| Default value.| **Return value** @@ -176,7 +175,7 @@ try { set(key: string, value: string, callback: AsyncCallback<void>): void -Sets a value for the attribute with the specified key. +Sets a value for the attribute with the specified key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Startup.SysInfo @@ -208,7 +207,7 @@ try { set(key: string, value: string): Promise<void> -Sets a value for the attribute with the specified key. +Sets a value for the attribute with the specified key. This API uses a promise to return the result. **System capability**: SystemCapability.Startup.SysInfo @@ -217,7 +216,7 @@ Sets a value for the attribute with the specified key. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | key | string | Yes| Key of the system attribute.| -| value| string | Yes| System attribute value to set.| +| value| string | Yes | System attribute value to set.| **Return value** diff --git a/en/readme/common-event-notification.md b/en/readme/common-event-notification.md index 9494b3d2eef1fe66272faa4be5bdbfd850cb581a..a4daa5486470def4bf309b363b7b66725656903b 100644 --- a/en/readme/common-event-notification.md +++ b/en/readme/common-event-notification.md @@ -36,10 +36,10 @@ Each application can subscribe to common events as required. After your applicat ## How to Use -For details, see *CommonEvent Development Guidelines*. +For details, see [Common Event Development](../application-dev/notification/common-event.md). ## Repositories Involved Common Event and Notification -[**notification_ces_standard**](https://gitee.com/openharmony/notification_ces_standard) +[**notification_ces_standard**](https://gitee.com/openharmony/notification_ces_standard) \ No newline at end of file