Chuyển tới nội dung chính

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

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);
}
};