Skip to main content

Class: UserSettingSaveManager

A manager for user settings that are saved and persistent across flight sessions. The manager facilitates saving and loading setting values to and from multiple keyed save slots and also supports auto-saving. Uses Data Store to store saved setting values.

Constructors

constructor

new UserSettingSaveManager(settings, bus): UserSettingSaveManager

Constructor.

Parameters

NameTypeDescription
settingsUserSetting<UserSettingValue>[]This manager's managed settings.
busEventBusThe event bus.

Returns

UserSettingSaveManager

Defined in

src/sdk/settings/UserSettingSaveManager.ts:38

Methods

destroy

destroy(): void

Destroys this manager. Once this manager is destroyed, all active autosaves will be stopped, and attempting to save, load, or start another autosave from this manager will cause an error to be thrown.

Returns

void

Defined in

src/sdk/settings/UserSettingSaveManager.ts:150


load

load(key): void

Loads the saved values of this manager's settings.

Parameters

NameTypeDescription
keystringThe key from which to load the values.

Returns

void

Throws

Error if this manager has been destroyed.

Defined in

src/sdk/settings/UserSettingSaveManager.ts:68


save

save(key): void

Saves the current values of this manager's settings.

Parameters

NameTypeDescription
keystringThe key to which to save the values.

Returns

void

Throws

Error if this manager has been destroyed.

Defined in

src/sdk/settings/UserSettingSaveManager.ts:88


startAutoSave

startAutoSave(key): void

Starts automatically saving this manager's settings when their values change.

Parameters

NameTypeDescription
keystringThe key to which to save the values.

Returns

void

Throws

Error if this manager has been destroyed.

Defined in

src/sdk/settings/UserSettingSaveManager.ts:105


stopAutoSave

stopAutoSave(key): void

Stops automatically saving this manager's settings when their values change.

Parameters

NameTypeDescription
keystringThe key to which to stop saving the values.

Returns

void

Throws

Error if this manager has been destroyed.

Defined in

src/sdk/settings/UserSettingSaveManager.ts:128