batchGetStorageSync(params: Object)

Requires:
BaseKit≥3.30.1@ray-js/ray≥1.7.60
Platforms:
iOSAndroid

Description

Asynchronously batch-get the values for the specified keys from local storage

Parameters

PropertyTypeRequiredDescription
keyListstring[]YesList of keys to fetch

Return Value

Type: Object↓
PropertyTypeDescription
dataListstring[]List of retrieved key-value pairs

Examples

import { batchSetStorage, batchGetStorage } from '@ray-js/ray'

// Batch retrieve local storage: first write in batch, then read in batch to demonstrate a full round trip
batchSetStorage({
  kvList: [
    { key: "k1", data: "v1" },
    { key: "k2", data: "v2" },
  ],
  success: () => {
    batchGetStorage({
      keyList: ["k1", "k2"],
      success: data => console.log("Batch read:", data.dataList),
      fail: error => console.error(error),
    });
  },
  fail: error => console.error(error),
});