Skip to content

Configuration and data ownership ​

Choose ownership before persistence. Appearance can differ per display while progress is shared across the installation.

DataInterfaceOwnership
Color, layout mode, refresh periodconfig.get/setPer instance; layouts can save/restore configuration
Small display-local statestorage.get/set/removeInstance KV; does not roll back with layouts
Game progress or tool documentssaves.load/commitAll installation instances share slots; revision CAS
Re-downloadable binary contentcache.*Reclaimable instance cache; misses are normal
Latest business hintscollaboration.*Temporary installation value; no durable history
Access tokenscredentials.* or user-bound secretsNever shared in packages, layouts, configuration or logs

Configuration fields ​

manifest.configuration is an array of fields, not an arbitrary settings object. An integer refreshSeconds field can declare label, default: 60, minimum: 15, maximum: 3600 and shareable: true. Read ready.configuration or config.get and subscribe to config.changed. Cancel old timers before rescheduling. See configuration rules.

json
{
  "key": "refreshSeconds",
  "label": "Refresh interval",
  "type": "integer",
  "default": 60,
  "minimum": 15,
  "maximum": 3600,
  "shareable": true
}

Revision-based saves ​

Load a slot with saves.load. Validate current.value before using it. Commit with slot, expectedRevision set to current.revision (or null for a new slot), and a versioned JSON value. Only a successful response advances your local revision.

js
const loaded = await widgetHost.call('saves.load', {slot: 'progress'}, {signal});
const saved = await widgetHost.call('saves.commit', {
  slot: 'progress',
  expectedRevision: loaded.current?.revision ?? null,
  value: {schemaVersion: 1, coins: 20}
}, {signal});

Here, signal belongs to the current operation. Validate the loaded business value before applying an update.

SAVE_CONFLICT requires reloading and a business merge or explicit conflict UI. Do not overwrite using the latest revision blindly or retry forever. A lost response requires a load before another write. Cancellation does not undo a published commit.

KV allows 256 KiB per value and 16 MiB per instance. Saves have separate budgets and keep the previous successful revision. Save at checkpoints and coalesce updates rather than writing every frame. Neither layouts nor package rollback restore persistent progress. See saves.

Current host contract · SDK 0.1.1 · MIT