| key | string | Yes| Key of the data to check. It cannot be empty.|
| key | string | Yes| Key of the data to check. It cannot be empty.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.|
**Example**
**Example**
```ts
```ts
...
@@ -409,14 +410,14 @@ Checks whether this **Preferences** instance contains data with a given key. Thi
...
@@ -409,14 +410,14 @@ Checks whether this **Preferences** instance contains data with a given key. Thi
| key | string | Yes| Key of the data to check. It cannot be empty.|
| key | string | Yes| Key of the data to check. It cannot be empty.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<boolean> | Promise used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.|
| Promise<boolean> | Promise used to return the result. It returns **true** if the **Preferences** instance contains data with the given key and returns **false** otherwise.|
**Example**
**Example**
```ts
```ts
...
@@ -428,7 +429,7 @@ promise.then((isExist) => {
...
@@ -428,7 +429,7 @@ promise.then((isExist) => {
console.info("The key of startup is not contained.")
console.info("The key of startup is not contained.")
}
}
}).catch((err)=>{
}).catch((err)=>{
console.info("Check the key of startup failed, err: "+err)
console.info("Failed to check the key of startup, err: "+err)
})
})
```
```
...
@@ -442,10 +443,10 @@ Deletes a KV pair of the specified key from this **Preferences** instance. This
...
@@ -442,10 +443,10 @@ Deletes a KV pair of the specified key from this **Preferences** instance. This
| type | string| Yes| Event type. The value **change** indicates data change events.|
| type | string | Yes| Event type. The value **change** indicates data change events.|
| callback | Callback<{ key : string }> | No| Callback used to return data changes. If this parameter is left empty, all callbacks for data changes will be canceled.|
| callback | Callback<{ key : string }> | No| Callback used to return data changes. If this parameter is left empty, all callbacks for data changes will be canceled.|