Interface: UserSettingManager<T>
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.
Type parameters
Name | Type |
---|---|
T | extends UserSettingRecord |
Implemented by
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.
Defined in
src/sdk/settings/UserSetting.ts:96
getSetting
▸ getSetting<K
>(name
): UserSetting
<NonNullable
<T
[K
]>>
Gets a setting from this manager.
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Description |
---|---|---|
name | K | The name of the setting to get. |
Returns
UserSetting
<NonNullable
<T
[K
]>>
The requested setting.
Throws
Error if no setting with the specified name exists.
Defined in
src/sdk/settings/UserSetting.ts:82
mapTo
▸ mapTo<M
>(map
): UserSettingManager
<M
& T
>
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
Name | Type |
---|---|
M | extends UserSettingRecord |
Parameters
Name | Type | Description |
---|---|---|
map | UserSettingMap <M , T > | 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
UserSettingManager
<M
& T
>
A new setting manager which supports accessing a subset of this manager's settings using aliased names.
Defined in
src/sdk/settings/UserSetting.ts:105
tryGetSetting
▸ tryGetSetting<K
>(name
): undefined
| UserSetting
<NonNullable
<T
[K
]>>
Attempts to get a setting from this manager.
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Description |
---|---|---|
name | K | The name of the setting to get. |
Returns
undefined
| UserSetting
<NonNullable
<T
[K
]>>
The requested setting, or undefined
if no such setting exists.
Defined in
src/sdk/settings/UserSetting.ts:74
whenSettingChanged
▸ whenSettingChanged<K
>(name
): Consumer
<NonNullable
<T
[K
]>>
Gets a consumer which notifies handlers when the value of a setting changes.
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Description |
---|---|---|
name | K | The name of a setting. |
Returns
Consumer
<NonNullable
<T
[K
]>>
a consumer which notifies handlers when the value of the setting changes.
Throws
Error if no setting with the specified name exists.
Defined in
src/sdk/settings/UserSetting.ts:90