Nhảy tới nội dung

getStorageInfo

Lưu ý

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

PropertyTypeDefaultRequiredDescriptionMinimum Version
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Return Values

Promise <Object data>

PropertyTypeDescriptionMinimum Version
currentSizenumberKhông gian hiện tại bị chiếm (tính bằng KB)
limitSizenumberGiớ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);
}
};