This interface is used to remove data from unified storage.
Use removeAPDataStorage interface
AlipayJSBridge.call('removeAPDataStorage', {
type: "common",
business: "customBusinessKey",
key: "customKey",
}, function(result) {
alert(JSON.stringify(result));
});Code example
<button id="J_saveDataBtn" class="btn">Save data</button>
<button id="J_getDataBtn" class="btn">View data</button>
<button id="J_removeDataBtn" class="btn">Delete data</button>
<script>
function ready(callback) {
// Call directly if JSBridge has been injected
if (window.AlipayJSBridge) {
callback && callback();
} else {
// Monitor the injected events if JSBridge hasn't been injected
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
ready(function() {
document.querySelector('#J_saveDataBtn').addEventListener('click', function(e) {
AlipayJSBridge.call('setAPDataStorage', {
type: "common",
business: "customBusinessKey",
key: "customKey",
value: "customValue"
}, function(result) {
alert(JSON.stringify(result));
});
}, false);
document.querySelector('#J_getDataBtn').addEventListener('click', function(e) {
AlipayJSBridge.call('getAPDataStorage', {
type: "common",
business: "customBusinessKey",
key: "customKey"
}, function(result) {
alert(JSON.stringify(result));
});
}, false);
document.querySelector('#J_removeDataBtn').addEventListener('click', function(e) {
AlipayJSBridge.call('removeAPDataStorage', {
type: "common",
business: "customBusinessKey",
key: "customKey"
}, function(result) {
alert(JSON.stringify(result));
});
}, false);
}, false);
</script>API
AlipayJSBridge.call('removeAPDataStorage', {
type, business, key
});Input parameters
Name | Type | Description | Required | Default value |
|---|---|---|---|---|
type | String | (user/common) User dimension storage or common storage; it defaults to common | N | “common” |
business | String | The customized service identifier, which can be agreed with the corresponding access code of client. It defaults to NebulaBiz | N | “” |
key | String | Key of customized data | Y | “” |
Output parameter
Parameter result brought in by callback function: {success}.
Name | Type | Description |
|---|---|---|
success | bool | Whether it is successfully deleted |