Skip to main content

Class: MappedUserSettingManager<T, O>

A manager for user settings. Provides settings using their names as keys, publishes value change events on the event bus, and keeps setting values up to date when receiving change events across the bus, using a mapping from abstracted settings keys to true underlying settings keys.

Type parameters

NameType
Textends UserSettingRecord
Oextends UserSettingRecord

Implements

Constructors

constructor

new MappedUserSettingManager<T, O>(parent, map): MappedUserSettingManager<T, O>

Creates an instance of a MappedUserSettingManager.

Type parameters

NameType
Textends UserSettingRecord
Oextends UserSettingRecord

Parameters

NameTypeDescription
parentUserSettingManager<O>The parent setting manager.
mapUserSettingMap<T, O>The map of abstracted keys to true underlying keys.

Returns

MappedUserSettingManager<T, O>

Defined in

src/sdk/settings/UserSetting.ts:345

Methods

getAllSettings

getAllSettings(): UserSetting<UserSettingValue>[]

Gets an array of all settings of this manager.

Returns

UserSetting<UserSettingValue>[]

an array of all settings of this manager.

Implementation of

UserSettingManager.getAllSettings

Defined in

src/sdk/settings/UserSetting.ts:366


getSetting

getSetting<K>(name): UserSetting<NonNullable<T & O[K]>>

Gets a setting from this manager.

Type parameters

NameType
Kextends string

Parameters

NameTypeDescription
nameKThe name of the setting to get.

Returns

UserSetting<NonNullable<T & O[K]>>

The requested setting.

Throws

Error if no setting with the specified name exists.

Implementation of

UserSettingManager.getSetting

Defined in

src/sdk/settings/UserSetting.ts:354


mapTo

mapTo<M>(map): MappedUserSettingManager<M, T & O>

Maps a subset of this manager's settings to ones with aliased names, and creates a new setting manager which supports accessing the settings using their aliases.

Type parameters

NameType
Mextends UserSettingRecord

Parameters

NameTypeDescription
mapUserSettingMap<M, T & O>A map defining the aliases of a subset of this manager's settings, with aliased setting names as keys and original setting names as values.

Returns

MappedUserSettingManager<M, T & O>

A new setting manager which supports accessing a subset of this manager's settings using aliased names.

Implementation of

UserSettingManager.mapTo

Defined in

src/sdk/settings/UserSetting.ts:371


tryGetSetting

tryGetSetting<K>(name): undefined | UserSetting<NonNullable<T & O[K]>>

Attempts to get a setting from this manager.

Type parameters

NameType
Kextends string

Parameters

NameTypeDescription
nameKThe name of the setting to get.

Returns

undefined | UserSetting<NonNullable<T & O[K]>>

The requested setting, or undefined if no such setting exists.

Implementation of

UserSettingManager.tryGetSetting

Defined in

src/sdk/settings/UserSetting.ts:348


whenSettingChanged

whenSettingChanged<K>(name): Consumer<NonNullable<T & O[K]>>

Gets a consumer which notifies handlers when the value of a setting changes.

Type parameters

NameType
Kextends string

Parameters

NameTypeDescription
nameKThe name of a setting.

Returns

Consumer<NonNullable<T & O[K]>>

a consumer which notifies handlers when the value of the setting changes.

Throws

Error if no setting with the specified name exists.

Implementation of

UserSettingManager.whenSettingChanged

Defined in

src/sdk/settings/UserSetting.ts:360