Modules

Capabilities

Storage

capability-storage

Per-prototype key-value persistence. Opaque-origin iframes have no reliable localStorage; the shell stores device-local values per prototype and isolates signed-in players on shared browsers.

Version
Part of the Prototir SDK
License
-
Runs on
Inside the Prototir player. Outside it, get returns null.

Smallest example

Example
await Prototir.storage.set('difficulty', 'hard');
const difficulty = await Prototir.storage.get('difficulty');

API

Prototir.storage

get(key)
The stored string, or null.
set(key, value)
Stores a string for this prototype and the signed-in player.
remove(key)
Removes a value.

Good to know

  • Keys up to 128 characters, values up to 64 KiB of UTF-8. Store JSON as a string for structured data.
  • Prototypes run in an isolated frame with no reliable localStorage, so this goes through the player.

As JSON: /modules/capability-storage.json. Source: Prototir.storage via Player Shell.