title: Taro.getStorageInfoSync()
sidebar_label: getStorageInfoSync
The synchronous version of Taro.getStorageInfo
.
Type
() => Option
Parameters
Option
Property | Type | Description |
---|---|---|
currentSize | number |
Current space occupied (in KB) |
keys | string[] |
All keys in the current storage |
limitSize | number |
Space size limit (in KB) |
Sample Code
Taro.getStorageInfo({
success: function (res) {
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
}
})
try {
const res = Taro.getStorageInfoSync()
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
} catch (e) {
// Do something when catch error
}
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.getStorageInfoSync | ✔️ | ✔️ |