Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 799 Bytes

data-storage.md

File metadata and controls

36 lines (23 loc) · 799 Bytes

Using Local Storage

Saving data

Data must be saved through the GMI. This ensures all data access complies with BBC data policies.

gmi.setGameData(key, value);

Stores a JSON key-value pair that can then be retrieved with getAllSettings().

Loading data

gmi.getAllSettings();

Returns a JSON object with global settings and specific game data.

Specific game data is stored under gameData:

gmi.getAllSettings().gameData;

This object will contain all of the properties set by this game using setGameData.

Global settings can be accessed like so:

gmi.getAllSettings().audio;
gmi.getAllSettings().motion;
gmi.getAllSettings().subtitles;