未验证 提交 939bb9d7 编写于 作者: 葛亚芳 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-data-preferences.md.

Signed-off-by: N@ge-yafang <geyafang@huawei.com>
上级 5e4504d2
...@@ -405,13 +405,13 @@ has(key: string, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -405,13 +405,13 @@ has(key: string, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
preferences.has('startup', function (err, isExist) { preferences.has('startup', function (err, isExist) {
if (err) { if (err) {
console.info("Failed to check the key of 'startup'. Cause: " + err); console.info("Failed to check the key 'startup'. Cause: " + err);
return; return;
} }
if (isExist) { if (isExist) {
console.info("The key of 'startup' is contained."); console.info("The key 'startup' is contained.");
} else { } else {
console.info("The key of 'startup' dose not contain."); console.info("The key 'startup' dose not contain.");
} }
}) })
``` ```
...@@ -626,7 +626,7 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen ...@@ -626,7 +626,7 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen
return; return;
} }
var observer = function (key) { var observer = function (key) {
console.info("The key of " + key + " changed."); console.info("The key " + key + " changed.");
} }
preferences.on('change', observer); preferences.on('change', observer);
preferences.put('startup', 'auto', function (err) { preferences.put('startup', 'auto', function (err) {
...@@ -670,7 +670,7 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen ...@@ -670,7 +670,7 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen
return; return;
} }
var observer = function (key) { var observer = function (key) {
console.info("The key of " + key + " changed."); console.info("The key " + key + " changed.");
} }
preferences.on('change', observer); preferences.on('change', observer);
preferences.put('startup', 'auto', function (err) { preferences.put('startup', 'auto', function (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册