getStorageInfo
Lưu ý
Cần xin cấp quyền tại trang Quản lý ứng dụng
Deprecated: API này đã dừng hỗ trợ. Vui lòng tham khảo api mới tại đây
Lấy thông tin của cache theo cơ chế bất đồng bộ.
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 { getStorageInfo } from "zmp-sdk/apis";
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
import { getStorageInfo } from "zmp-sdk/apis";
const getMiniAppStorageInfo = async () => {
try {
const { currentSize, limitSize } = await getStorageInfo({});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};