my.setStorage
Specification
The following table is a specification of this JSAPI:
JSAPI Name |
|
Description | This JSAPI is used to store the data with a specified key in the local cache. This will overlaps the original data using the same key. This is an asynchronous interface, works in DSL and non-DSL |
Request
The following part describe about parameter of request in this JSAPI:
Request Parameter
The following table is a request parameter in this JSAPI:
Name | Type | Required | Condition | Remarks |
key | String | Mandatory | - | Cache data key |
data | Object | Mandatory | - | Data to be cached |
success | Function | Optional | - | Callback function upon call success |
fail | Function | Optional | - | Callback function upon call failure |
Data Object
The following table is data of data object:
Name | Type | Required | Condition | Remarks |
cityName | String | Mandatory | - | The name of the city |
adCode | String | Mandatory | - | The address code of the city |
spell | String | Mandatory | - | The spelling of the city |
Request Sample
The following script is a request sample of this JSAPI:
my.setStorage({
key: 'currentCity',
data: {
cityName: 'London',
adCode: '330100',
spell: ' London',
},
success: function() {
my.alert({content: 'Set Success'});
}
});