未验证 提交 45ed8b3c 编写于 作者: O openharmony_ci 提交者: Gitee

!23939 翻译完成 23553:js-apis-settings.md

Merge pull request !23939 from ester.zhou/TR-23553
...@@ -608,20 +608,6 @@ Sets the value for a data item. This API uses an asynchronous callback to return ...@@ -608,20 +608,6 @@ Sets the value for a data item. This API uses an asynchronous callback to return
| value | object | Yes | Value of the data item. The value range varies by service. | | value | object | Yes | Value of the data item. The value range varies by service. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility';
// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update its value.)
let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS);
let helper = featureAbility.acquireDataAbilityHelper(uri);
//@ts-ignore
// The value of the data item is a string.
settings.setValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '100', (status) => {
console.log('Callback return whether value is set.');
});
```
## settings.setValue<sup>(deprecated)</sup> ## settings.setValue<sup>(deprecated)</sup>
...@@ -653,21 +639,6 @@ Sets the value for a data item. This API uses a promise to return the result. ...@@ -653,21 +639,6 @@ Sets the value for a data item. This API uses a promise to return the result.
| ----------------- | -------------------------------------------------- | | ----------------- | -------------------------------------------------- |
| Promise\<boolean> | Promise used to return the result. Returns **true** if the operation is successful; returns **false** otherwise.| | Promise\<boolean> | Promise used to return the result. Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility';
// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update its value.)
let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS);
let helper = featureAbility.acquireDataAbilityHelper(uri);
//@ts-ignore
// The value of the data item is a string.
settings.setValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '100').then((status) => {
console.log('Callback return whether value is set.');
});
```
## setting.getValue<sup>(deprecated)</sup> ## setting.getValue<sup>(deprecated)</sup>
getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册