getStorageInfo
Lưu ý
Với API version ﹤ 2.23.0, phải gọi api login trước khi gọi api này và cần xin cấp quyền tại trang Quản lý ứng dụng
Lấy thông tin của cache.
Parameters
Object object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
success | function | Callback function khi gọi api thành công | |||
fail | function | Callback function khi gọi api thất bại |
Return Values
Promise<Object data>
Property | Type | Description | Minimum Version |
---|---|---|---|
currentSize | number | Không gian hiện tại bị chiếm (tính bằng KB) | |
limitSize | number | Giới hạn kích thước không gian (tính bằng KB) |
Sample Code
import api from 'zmp-sdk';
api.getStorageInfo({
success: (data) => {
// xử lý khi gọi api thành công
const { currentSize, limitSize } = data;
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});
// hoặc
const test = async () => {
try {
const { currentSize, limitSize } = await api.getStorageInfo({});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};