MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / preference

Method preference

src/monogatari.ts:1226–1239  ·  view source on GitHub ↗
(key: K, value?: PlayerPreferences[K] | null)

Source from the content-addressed store, hash-verified

1224 */
1225 static preference<K extends keyof PlayerPreferences>(key: K, value: PlayerPreferences[K]): PlayerPreferences[K];
1226 static preference<K extends keyof PlayerPreferences>(key: K, value?: PlayerPreferences[K] | null): PlayerPreferences[K] {
1227 if (value !== undefined && value !== null) {
1228 this._preferences[key] = value;
1229 this.Storage.update('Settings', this._preferences);
1230
1231 return this._preferences[key];
1232 }
1233
1234 if (typeof this._preferences[key] !== 'undefined') {
1235 return this._preferences[key];
1236 }
1237
1238 throw new Error(`Tried to access non existent preference with name '${key}'.`);
1239 }
1240
1241 static preferences (object: Partial<PlayerPreferences> | null = null, save = false): PlayerPreferences {
1242 if (object !== null) {

Callers 15

scriptMethod · 0.95
bindMethod · 0.80
applyMethod · 0.80
initMethod · 0.80
bindMethod · 0.80
constructorMethod · 0.80
initiateMethod · 0.80
didMountMethod · 0.80
desktopMethod · 0.80
didMountMethod · 0.80
playAmbientFunction · 0.80
autoPlayFunction · 0.80

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected