getStorageInfo(params: Object)

Requires:
BaseKit≥3.30.1@ray-js/ray≥1.7.60
Platforms:
iOSAndroid
import { getStorageInfo } from '@ray-js/ray';

// Promise usage
try {
  const res = await getStorageInfo();
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Asynchronously obtain information about the current storage

Parameters

PropertyTypeRequiredDescription
complete() => voidNoCompletion callback (executed on both success and failure)
success(params: Object) => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
success callback parameters
PropertyTypeDescription
keysstring[]All keys in the current storage
currentSizenumberCurrent space used, in KB
limitSizenumberSpace limit, in KB
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { getStorageInfo } from '@ray-js/ray'

// Get current storage info: all keys, used size, limit size (KB)
getStorageInfo({
  success: data => console.log("keys:", data.keys, "used:", data.currentSize, "limit:", data.limitSize),
  fail: error => console.error(error),
});