Skip to content

Local storage

FRVR.localStorage is an async, channel‑agnostic wrapper around whichever storage backend makes sense for the current platform (typically window.localStorage on web, SharedPreferences on Android, NSUserDefaults on iOS).

Use it instead of window.localStorage directly — it works identically across channels and gracefully degrades to an in‑memory store where persistence isn’t available.

await FRVR.localStorage.setItem('coins', '100');
const coins = await FRVR.localStorage.getItem('coins');
await FRVR.localStorage.removeItem('coins');

Values are strings. Serialize objects yourself:

await FRVR.localStorage.setItem('inventory', JSON.stringify(inventory));
const json = await FRVR.localStorage.getItem('inventory');
const inv  = json ? JSON.parse(json) : [];
Use local storage when…Use cloud storage when…
Data is cheap to regenerateLosing it ruins the player’s progress
It’s device‑specific (preferences, cache)It should follow the player across devices
You don’t need authThe player is logged in

Local storage: get/set/remove

loading SDK…