提交 f7d3d376 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 9f08600c
...@@ -90,9 +90,9 @@ Use the following APIs to delete a **Storage** instance or data file. ...@@ -90,9 +90,9 @@ Use the following APIs to delete a **Storage** instance or data file.
context.getFilesDir().then((filePath) => { context.getFilesDir().then((filePath) => {
path = filePath; path = filePath;
console.info("======================>getFilesDirPromsie====================>"); console.info("======================>getFilesDirPromsie====================>");
});
let promise = dataStorage.getStorage(path + '/mystore'); let promise = dataStorage.getStorage(path + '/mystore');
});
``` ```
...@@ -120,14 +120,15 @@ Use the following APIs to delete a **Storage** instance or data file. ...@@ -120,14 +120,15 @@ Use the following APIs to delete a **Storage** instance or data file.
```js ```js
promise.then((storage) => { promise.then((storage) => {
let getPromise = storage.get('startup', 'default'); let getPromise = storage.get('startup', 'default')
getPromise.then((value) => { getPromise.then((value) => {
console.info("The value of startup is " + value); console.info("The value of startup is " + value);
}).catch((err) => { }).catch((err) => {
console.info("Failed to get the value of startup with err: " + err); console.info("Failed to get the value of startup with err: " + err);
}) })
}).catch((err) => { }).catch((err) => {
console.info("Failed to get the storage."); console.info("Failed to get the storage.")
}) })
``` ```
...@@ -149,7 +150,7 @@ Use the following APIs to delete a **Storage** instance or data file. ...@@ -149,7 +150,7 @@ Use the following APIs to delete a **Storage** instance or data file.
var observer = function (key) { var observer = function (key) {
console.info("The key of " + key + " changed."); console.info("The key of " + key + " changed.");
} }
storage.on('change', observer); storage.on('change', observer)
storage.putSync('startup', 'auto'); // Modify data in the Storage instance. storage.putSync('startup', 'auto'); // Modify data in the Storage instance.
storage.flushSync(); // Trigger the StorageObserver callback. storage.flushSync(); // Trigger the StorageObserver callback.
...@@ -169,7 +170,7 @@ Use the following APIs to delete a **Storage** instance or data file. ...@@ -169,7 +170,7 @@ Use the following APIs to delete a **Storage** instance or data file.
promise.then(() => { promise.then(() => {
console.info("Succeeded in deleting the storage."); console.info("Succeeded in deleting the storage.");
}).catch((err) => { }).catch((err) => {
console.info("Failed to deleted the storage with err: " + err); console.info("Failed to delete the storage with err: " + err);
}) })
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册