mgtv.getStorageInfoSync()
框架版本 0.1.1 开始支持。
同步获取当前 storage 的相关信息。
返回值
Object object
属性 | 类型 | 说明 |
---|---|---|
keys | array<string> | 当前 storage 中所有的 key |
currentSize | number | 当前占用的空间大小, 单位 KB |
limitSize | number | 限制的空间大小,单位 KB |
示例代码
try {
const { keys, currentSize, limitSize } = mgtv.getStorageInfoSync();
console.log(keys);
console.log(currentSize);
console.log(limitSize);
} catch (e) {
// Do something when catch error
}