Skip to content

StoredSettings beta ​

Class of @v12-engine/client/app

ts
export declare class StoredSettings implements SettingsLike

The settings with no game running: a screen of them before the game (a start menu's Settings, settingsScene). The client's and the game's own (GameView.hud.settings), as a game would list them, their values read from where they are kept (ready) and written back as they are set, for the next game to read as it starts. What a setting does to the client (apply) waits for one; what one is before it was ever set (initial) is its default here

Members ​

constructor ​

ts
constructor(
    game?: GameSettings, 
    store?: SettingsStore, 
    languages?: Languages);

Constructs a new instance of the StoredSettings class

def ​

ts
def(id: string): SettingDef | undefined;

The definition of the setting with that id, or undefined where there is none

get ​

ts
get<V extends SettingValue = SettingValue>(id: string): V;

The value of a setting by its id, typed as V; throws where there is no such setting

list ​

ts
readonly list: Accessor<readonly SettingDef[]>;

Every setting there is, in order: the client's, then the game's own

ready ​

ts
readonly ready: Promise<void>;

Done when what was kept is read and shown. Never rejects: a store that cannot be read leaves the defaults

reset ​

ts
reset(id?: string): void;

Puts a setting back to its default, or every setting not hidden when no id is given

set ​

ts
set(id: string, value: SettingValue): void;

Sets a setting, fitted to its definition; the store keeps it and what listens hears of it. Throws where there is no such setting

shown ​

ts
shown(def: SettingDef): boolean;

Whether the settings screen lists a setting: with no game running, whatever is not hidden