getStorageSync(params: Object)

Requires:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
Platforms:
iOSAndroid

Description

Asynchronously get the value for the specified key from local storage

Parameters

PropertyTypeRequiredDescription
keystringYesThe specified key in local storage

Return Value

Type: any
Value corresponding to the key

Examples

import { setStorage, getStorage } from '@ray-js/ray'

// Get the value of the specified key in local storage: write then read to demonstrate a full round trip
setStorage({
  key: "demoKey",
  data: "demoValue",
  success: () => {
    getStorage({
      key: "demoKey",
      success: data => console.log("Read value:", data),
      fail: error => console.error(error),
    });
  },
  fail: error => console.error(error),
});